<html>
    <body>
        <article>
            <div id="article_content" class="article_content clearfix csdn-tracking-statistics" data-pid="blog" data-mod="popu_307" data-dsm="post">
                                                <div class="markdown_views">
                                <!-- flowchart 箭头图标 勿删 -->
                                <svg xmlns="http://www.w3.org/2000/svg" style="display: none;"><path stroke-linecap="round" d="M5,0 0,2.5 5,5z" id="raphael-marker-block" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);"></path></svg>
                                <p></p><div class="toc">
    <ul>
    <li><a href="#x509-certificates" rel="nofollow" target="_self">X509 Certificates</a></li>
    <li><a href="#1-certificates" rel="nofollow" target="_self">1 Certificates</a><ul>
    <li><a href="#1-1-structure-of-a-certificate" rel="nofollow" target="_self">1-1 Structure of a Certificate</a></li>
    <li><a href="#1-2-extensions-informing-a-specific-usage-of-a-certficate" rel="nofollow" target="_self">1-2 Extensions informing a specific usage of a certficate</a></li>
    <li><a href="#1-3-certificate-filename-extensions" rel="nofollow" target="_self">1-3 Certificate filename extensions</a></li>
    </ul>
    </li>
    <li><a href="#2-certificate-chains-and-cross-certification" rel="nofollow" target="_self">2    Certificate chains and cross-certification</a><ul>
    <li><a href="#2-1-example-1-cross-certification-at-root-certification-authority-ca-level-between-two-pkis" rel="nofollow" target="_self">2-1 Example 1 Cross-certification at root Certification Authority CA level between two PKIs</a></li>
    <li><a href="#2-2-example-2-ca-certificate-renewal" rel="nofollow" target="_self">2-2 Example 2 CA certificate renewal</a></li>
    </ul>
    </li>
    <li><a href="#3-sample-x509-certificates" rel="nofollow" target="_self">3    Sample X509 certificates</a><ul>
    <li><a href="#3-1-end-entity-certificate" rel="nofollow" target="_self">3-1 End-entity certificate</a></li>
    <li><a href="#3-2-intermediate-certificate" rel="nofollow" target="_self">3-2 Intermediate certificate</a></li>
    <li><a href="#3-3-root-certificate" rel="nofollow" target="_self">3-3 Root certificate</a></li>
    </ul>
    </li>
    <li><a href="#4-security" rel="nofollow" target="_self">4    Security</a><ul>
    <li><a href="#4-1-architectural-weaknesses" rel="nofollow" target="_self">4-1 Architectural weaknesses</a></li>
    <li><a href="#4-2-problems-with-certificate-authorities" rel="nofollow" target="_self">4-2 Problems with certificate authorities</a></li>
    <li><a href="#4-3-implementation-issues" rel="nofollow" target="_self">4-3 Implementation issues</a></li>
    <li><a href="#4-4-cryptographic-weaknesses" rel="nofollow" target="_self">4-4 Cryptographic weaknesses</a><ul>
    <li><a href="#4-4-1-mitigations-for-cryptographic-weaknesses" rel="nofollow" target="_self">4-4-1  Mitigations for cryptographic weaknesses</a></li>
    </ul>
    </li>
    </ul>
    </li>
    <li><a href="#5-pkcs-standards-summary" rel="nofollow" target="_self">5 PKCS Standards Summary</a></li>
    <li><a href="#6-openssl-certificate-authority" rel="nofollow" target="_self">6 OpenSSL Certificate Authority</a><ul>
    <li><a href="#6-1-introduction" rel="nofollow" target="_self">6-1 Introduction</a></li>
    <li><a href="#6-2-create-the-root-pair" rel="nofollow" target="_self">6-2 Create the root pair</a><ul>
    <li><a href="#6-2-1prepare-the-directory" rel="nofollow" target="_self">6-2-1Prepare the directory</a></li>
    <li><a href="#6-2-2-prepare-the-configuration-file" rel="nofollow" target="_self">6-2-2 Prepare the configuration file</a></li>
    <li><a href="#6-2-3-create-the-root-key" rel="nofollow" target="_self">6-2-3 Create the root key</a></li>
    <li><a href="#6-2-4-create-the-root-certificate" rel="nofollow" target="_self">6-2-4 Create the root certificate</a></li>
    <li><a href="#6-2-5-verify-the-root-certificate" rel="nofollow" target="_self">6-2-5 Verify the root certificate</a></li>
    </ul>
    </li>
    <li><a href="#6-3-create-the-intermediate-pair" rel="nofollow" target="_self">6-3 Create the intermediate pair</a><ul>
    <li><a href="#6-3-1-prepare-the-directory" rel="nofollow" target="_self">6-3-1 Prepare the directory</a></li>
    <li><a href="#6-3-2-create-the-intermediate-key" rel="nofollow" target="_self">6-3-2 Create the intermediate key</a></li>
    <li><a href="#6-3-3-create-the-intermediate-certificate" rel="nofollow" target="_self">6-3-3 Create the intermediate certificate</a></li>
    <li><a href="#6-3-4-verify-the-intermediate-certificate" rel="nofollow" target="_self">6-3-4 Verify the intermediate certificate</a></li>
    <li><a href="#6-3-5-create-the-certificate-chain-file" rel="nofollow" target="_self">6-3-5 Create the certificate chain file</a></li>
    </ul>
    </li>
    <li><a href="#6-4-sign-server-and-client-certificates" rel="nofollow" target="_self">6-4 Sign server and client certificates</a><ul>
    <li><a href="#6-4-1-create-a-key" rel="nofollow" target="_self">6-4-1 Create a key</a></li>
    <li><a href="#6-4-2-create-a-certificate" rel="nofollow" target="_self">6-4-2 Create a certificate</a></li>
    <li><a href="#6-4-3-verify-the-certificate" rel="nofollow" target="_self">6-4-3 Verify the certificate</a></li>
    <li><a href="#6-4-4-deploy-the-certificate" rel="nofollow" target="_self">6-4-4 Deploy the certificate</a></li>
    </ul>
    </li>
    <li><a href="#6-5-certificate-revocation-lists" rel="nofollow" target="_self">6-5 Certificate Revocation Lists</a><ul>
    <li><a href="#6-5-1-prepare-the-configuration-file" rel="nofollow" target="_self">6-5-1 Prepare the configuration file</a></li>
    <li><a href="#6-5-2-create-the-crl" rel="nofollow" target="_self">6-5-2 Create the CRL</a></li>
    <li><a href="#6-5-3-revoke-a-certificate" rel="nofollow" target="_self">6-5-3 Revoke a certificate</a></li>
    <li><a href="#6-5-4-server-side-use-of-the-crl" rel="nofollow" target="_self">6-5-4 Server-side use of the CRL</a></li>
    <li><a href="#6-5-5-client-side-use-of-the-crl" rel="nofollow" target="_self">6-5-5 Client-side use of the CRL</a></li>
    </ul>
    </li>
    <li><a href="#6-6-online-certificate-status-protocol" rel="nofollow" target="_self">6-6 Online Certificate Status Protocol</a><ul>
    <li><a href="#6-6-1-prepare-the-configuartion-file" rel="nofollow" target="_self">6-6-1 Prepare the configuartion file</a></li>
    <li><a href="#6-6-2-create-the-ocsp-pair" rel="nofollow" target="_self">6-6-2 Create the OCSP pair</a></li>
    <li><a href="#6-6-3-revoke-a-certificate" rel="nofollow" target="_self">6-6-3 Revoke a certificate</a></li>
    </ul>
    </li>
    <li><a href="#6-7-appendix" rel="nofollow" target="_self">6-7 Appendix</a><ul>
    <li><a href="#6-7-1-root-ca-configuration-file" rel="nofollow" target="_self">6-7-1 Root CA configuration file</a></li>
    <li><a href="#6-7-2-intermediate-ca-configuration-file" rel="nofollow" target="_self">6-7-2 Intermediate CA configuration file</a></li>
    </ul>
    </li>
    </ul>
    </li>
    </ul>
    </div>
    <p></p>
    
    
    
    <h1 id="x509-certificates"><a name="t0"></a>X.509 Certificates</h1>
    
    
    
    <h1 id="1-certificates"><a name="t1"></a>1) Certificates</h1>
    
    <p>In the X.509 system, an organization that want to a signed certificate requests one via a certificate signing request</p>
    
    <p>To do this , it first generates a key pair, keeping the private key secret adn using it to sign the CSR. This contains information indentifying the application and the applicant’s public key that is used to verfiy the signature of the CSR - and the Distiguished Name (DN) that the certificate is for. The CSR may be accompanied by other credentials or proofs of identity required by the certificate authority.</p>
    
    <p>The certificate authority issues a certificate binding a public key to particular distinguished name.</p>
    
    <p>An organization’s trusted root certificates can be distributed to all employees so that they can use the company PKI system. Browsers such as internet Explorer, FireFox, Safari and Chrome come with a predetermined set of root certificates pre-installed, so SSL certificates from major certificate autorities will work instantly; in effort the browsers’ developers detemine which CAs are trusted third parties for the browsers’ users. For example, FireFox provides a CSV and/or HTML file containing a list of include CAs.</p>
    
    <p>X.509 also includes standards for certificate revocation list (CRL) implementations, an often neglected aspect of PKI system. The IETF-approved way of checking a certificates’s validity is the Online Certficate Status Protocol (OCSP). Firefox 3 enables OCSP checking by default, as do versions of Windows from at least Vista and later</p>
    
    
    
    <h2 id="1-1-structure-of-a-certificate"><a name="t2"></a>1-1) Structure of a Certificate</h2>
    
    <p>The structure foreseen by the standards is expressed in a formal language Abstract Syntax Notation One. <br>
    The structure of an X.509 v3 digital certificate is as follows:</p>
    
    <ul>
    <li>Certificate <br>
    <ul><li>Version Number</li>
    <li>Serial Number</li>
    <li>Signature Algorithm ID</li>
    <li>Issuer Name</li>
    <li>Validity period <br>
    <ul><li>Not before</li>
    <li>Not after</li></ul></li>
    <li>Subject Name</li>
    <li>Subject pbulic Key Info <br>
    <ul><li>Public Key Algorithm</li>
    <li>Subject Public Key</li></ul></li>
    <li>Issuer Unique Identifier (optional)</li>
    <li>Subject Unique Identifier (optional)</li>
    <li>Extensions (optional) <br>
    <ul><li>…</li></ul></li></ul></li>
    <li>Certificate Sigature Algorithm</li>
    <li>Certificate Signature    </li>
    </ul>
    
    
    
    <h2 id="1-2-extensions-informing-a-specific-usage-of-a-certficate"><a name="t3"></a>1-2) Extensions informing a specific usage of a certficate</h2>
    
    <p>RFC 5280 (and its predecessors) defines a number certificates extensions which indicate how the certificate should be used. Most of them arcs from the joint-iso-ccitt(2) ds(5) id-ce(29) OID. Some of the most common, defined in section 4.2.1 are:</p>
    
    <ul>
    <li>Basic Constraints, {id-ce 19}, are used to indicate whether the certificate belongs to a CA.</li>
    <li>Key Usage, {id-ce 15}, provides a specifying the cryptograhic operations which may be performed using the public key contained in the certificate; for example, it could indicate that the key should be used for signatures but not for encipherment.</li>
    <li>Extended Key Usage, {id-ce 37}, is used, typically on a leaf certificate, to indicate the purpose of the public key contained in the certificate. It contains a list of OIDs, each of which indicates an allowed use. For example, {id-pkix 31} indicates that the key may be used on the server end of a TLS or SSL connection; {id-pkix 34} indicates that the key may be used to secure email.</li>
    </ul>
    
    <p>In general, if a certificate has several extensions restricting its use, all restrictions must be statified for a given use to be appropriate.</p>
    
    
    
    <h2 id="1-3-certificate-filename-extensions"><a name="t4"></a>1-3) Certificate filename extensions</h2>
    
    <p>There are several commonly used filename extensions for X.509 certificates. Unfortunately, some of these extensions are also used for other data such as private keys.</p>
    
    <ul>
    <li>.pem - (Privacy-enhanced Electronic Mail) Base64 encoded DER certificate, enclosed between “—–BEGIN CERTIFICATE—–” and “—–END CERTIFICATE—–”</li>
    <li>.cer, .crt, .der - usually in binary DER form, but Base64-enclosed certificates are common too</li>
    <li>.p7b, .p7c - PKC#7 SignedData structure without data, just certificate(s) or CRL(s)</li>
    <li>.p12 - PKCS#12, may contain certificate(s)(public) and private keys (password protected)</li>
    <li>.pfx -PFX, predecessor of PKCS#12 (usually contains data in PKCS#12 format, e.g, with PFX fiels generated in IIS)</li>
    </ul>
    
    <p>PKCS#7 is a standard for signing or encripting (officially called “envoloping”)data. Since the certificate is needed to verify signed data, it is possible to include them in the SignedData struture. A .p7c file is a degenerated SignedData struture, without any data to sign.</p>
    
    <p>PKCS#12 evolved from the personal information exchange (PFX) standard and is used to exchange public and private objects in a single file.</p>
    
    
    
    <h1 id="2-certificate-chains-and-cross-certification"><a name="t5"></a>2)    Certificate chains and cross-certification</h1>
    
    <p>A cetificate chain (see the equivalent concept of “certification path” defined by RFC 5280) is a list of certificates (usually starting with an end-entity certificate) followed by one or more CA certificates (usually the last one being a self-signed certificate), with the following properties:</p>
    
    <ol>
    <li>The Issuer of each certificate (except the last one) matches the Subject of the next certificate in the list.</li>
    <li>Each certificate (except the last one) is supposed to be signed by the secret key corresponding to the next certificate in the chain (i.e the signature of one certificate can be verifed using the public key contained in the following certificate).</li>
    <li>The last certificate in the list is a trust anchor: a certificate that you trust because it was delivered to you by some trustworthy procedure.</li>
    </ol>
    
    <p>Certificate chains are used in order to check that the public key (PK) contained in a target certificate (the first certificate in the chain) and other data contained in it effectively belongs to its subject. In order to ascertain this, the signature on the target certificate is verified by using the PK contained in the following certificate, whose signature is verified using the next certificate, and so on until the last certificate in the chain is reached. As the last certificate is a trust anchor, successfully reaching it will prove that the target certificate can be trusted.</p>
    
    <p>The description in the preceding paragraph is a simplified view on the certification path validation process as defined by RFC 5280,[10] which involves additional checks, such as verifying validity dates on certificates, looking up CRLs, etc.</p>
    
    <p>Example 1: Cross-certification between two PKIs</p>
    
    <p>Example 2: CA certificate renewal <br>
    Examining how certificate chains are built and validated, it is important to note that a concrete certificate can be part of very different certificate chains (all of them valid). This is because several CA certificates can be generated for the same subject and public key signing them with different private keys (from different CAs or different private keys from the same CA). So, although a single X.509 certificate can have only one issuer and one CA signature, it can be validly linked to more than one certificate building completely different certificate chains. This is crucial for cross-certification between PKIs and other applications. [11] See the following examples.</p>
    
    <p>In these diagrams:</p>
    
    <p>Each box represents a certificate, with its Subject in bold. <br>
    A → B means “A is signed by B” (or, more precisely, “A is signed by the secret key corresponding to the public key contained in B”). <br>
    Certificates with the same color (that are not white/transparent) contain the same public key.</p>
    
    
    
    <h2 id="2-1-example-1-cross-certification-at-root-certification-authority-ca-level-between-two-pkis"><a name="t6"></a>2-1) Example 1: Cross-certification at root Certification Authority (CA) level between two PKIs</h2>
    
    <p>Example 1: Cross-certification at root Certification Authority (CA) level between two PKIs[edit source] <br>
    In order to manage that user certificates existing in PKI 2 (like “User 2”) are trusted by PKI 1, CA1 generates a certificate (cert2.1) containing the public key of CA2. [12] Now both “cert2 and cert2.1 (in green) have the same subject and public key, so there are two valid chains for cert2.2 (User 2): “cert2.2 → cert2” and “cert2.2 → cert2.1 → cert1”.</p>
    
    <p>Similarly, CA2 can generate a certificate (cert1.1) containing the public key of CA1 so that user certificates existing in PKI 1 (like “User 1”) are trusted by PKI 2.</p>
    
    <p><img src="https://en.wikipedia.org/wiki/File:Cross-certification_diagram.svg" alt="Example 1: Cross-certification between two PKIs" title=""></p>
    
    
    
    <h2 id="2-2-example-2-ca-certificate-renewal"><a name="t7"></a>2-2) Example 2: CA certificate renewal</h2>
    
    <p>Understanding Certification Path Construction (PDF). PKI Forum. September 2002. To allow for graceful transition from the old signing key pair to the new signing key pair, the CA should issue a certificate that contains the old public key signed by the new private signing key and a certificate that contains the new public key signed by the old private signing key. Both of these certificates are self-issued, but neither is self-signed. Note that these are in addition to the two self-signed certificates (one old, one new).</p>
    
    <p>Since both cert1 and cert3 contain the same public key (the old one), there are two valid certificate chains for cert5: “cert5 → cert1” and “cert5 → cert3 → cert2”, and analogously for cert6. This allows that old user certificates (such as cert5) and new certificates (such as cert6) can be trusted indifferently by a party having either the new root CA certificate or the old one as trust anchor during the transition to the new CA keys.[13]</p>
    
    <p><img src="https://en.wikipedia.org/wiki/File:CA_certificate_renewal.png" alt="Example 2: CA certificate renewal" title=""></p>
    
    
    
    <h1 id="3-sample-x509-certificates"><a name="t8"></a>3)    Sample X.509 certificates</h1>
    
    <p>This is an example of a decoded X.509 certificate for wikipedia.org and several other Wikipedia websites. It was issued by GlobalSign, as stated in the Issuer field. Its Subject field describes Wikipedia as an organization, and its Subject Alternative Name field describes the hostnames for which it can be used. The Subject Public Key Info field contains an ECDSA public key, while the signature at the bottom is generated by GlobalSign’s RSA private key.</p>
    
    
    
    <h2 id="3-1-end-entity-certificate"><a name="t9"></a>3-1) End-entity certificate</h2>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs avrasm has-numbering"><span class="hljs-label">Certificate:</span>
        Data:
            Version: <span class="hljs-number">3</span> (<span class="hljs-number">0x2</span>)
            Serial Number:
                <span class="hljs-number">10</span>:e6:fc:<span class="hljs-number">62</span>:b7:<span class="hljs-number">41</span>:<span class="hljs-number">8</span>a:d5:<span class="hljs-number">00</span>:<span class="hljs-number">5</span>e:<span class="hljs-number">45</span>:b6
        Signature Algorithm: sha256WithRSAEncryption
            Issuer: C=BE, O=GlobalSign nv-sa, CN=GlobalSign Organization Validation CA - SHA256 - G2
            Validity
                Not Before: Nov <span class="hljs-number">21</span> <span class="hljs-number">08</span>:<span class="hljs-number">00</span>:<span class="hljs-number">00</span> <span class="hljs-number">2016</span> GMT
                Not After : Nov <span class="hljs-number">22</span> <span class="hljs-number">07</span>:<span class="hljs-number">59</span>:<span class="hljs-number">59</span> <span class="hljs-number">2017</span> GMT
            Subject: C=US, <span class="hljs-keyword">ST</span>=California, L=San Francisco, O=Wikimedia Foundation, <span class="hljs-keyword">Inc</span>., CN=*<span class="hljs-preprocessor">.wikipedia</span><span class="hljs-preprocessor">.org</span>
            Subject Public Key Info:
                Public Key Algorithm: id-ecPublicKey
                    Public-Key: (<span class="hljs-number">256</span> bit)
                    pub: 
                        <span class="hljs-number">04</span>:c9:<span class="hljs-number">22</span>:<span class="hljs-number">69</span>:<span class="hljs-number">31</span>:<span class="hljs-number">8</span>a:d6:<span class="hljs-number">6</span>c:ea:da:c3:<span class="hljs-number">7</span>f:<span class="hljs-number">2</span>c:ac:a5:
                        af:c0:<span class="hljs-number">02</span>:ea:<span class="hljs-number">81</span>:cb:<span class="hljs-number">65</span>:b9:fd:<span class="hljs-number">0</span>c:<span class="hljs-number">6</span>d:<span class="hljs-number">46</span>:<span class="hljs-number">5</span>b:c9:<span class="hljs-number">1</span>e:
                        ed:b2:ac:<span class="hljs-number">2</span>a:<span class="hljs-number">1</span>b:<span class="hljs-number">4</span>a:ec:<span class="hljs-number">80</span>:<span class="hljs-number">7</span>b:e7:<span class="hljs-number">1</span>a:<span class="hljs-number">51</span>:e0:df:f7:
                        c7:<span class="hljs-number">4</span>a:<span class="hljs-number">20</span>:<span class="hljs-number">7</span>b:<span class="hljs-number">91</span>:<span class="hljs-number">4</span>b:<span class="hljs-number">20</span>:<span class="hljs-number">07</span>:<span class="hljs-number">21</span>:ce:cf:<span class="hljs-number">68</span>:<span class="hljs-number">65</span>:<span class="hljs-number">8</span>c:c6:
                        <span class="hljs-number">9</span>d:<span class="hljs-number">3</span>b:ef:d5:c1
                    ASN1 OID: prime256v1
                    NIST CURVE: P-<span class="hljs-number">256</span>
            X509v3 extensions:
                X509v3 Key Usage: critical
                    Digital Signature, Key Agreement
                Authority Information Access: 
                    CA Issuers - URI:http://secure<span class="hljs-preprocessor">.globalsign</span><span class="hljs-preprocessor">.com</span>/cacert/gsorganizationvalsha2g2r1<span class="hljs-preprocessor">.crt</span>
                    OCSP - URI:http://ocsp2<span class="hljs-preprocessor">.globalsign</span><span class="hljs-preprocessor">.com</span>/gsorganizationvalsha2g2
    
                X509v3 Certificate Policies: 
                    Policy: <span class="hljs-number">1.3</span><span class="hljs-number">.6</span><span class="hljs-number">.1</span><span class="hljs-number">.4</span><span class="hljs-number">.1</span><span class="hljs-number">.4146</span><span class="hljs-number">.1</span><span class="hljs-number">.20</span>
                      CPS: https://www<span class="hljs-preprocessor">.globalsign</span><span class="hljs-preprocessor">.com</span>/repository/
                    Policy: <span class="hljs-number">2.23</span><span class="hljs-number">.140</span><span class="hljs-number">.1</span><span class="hljs-number">.2</span><span class="hljs-number">.2</span>
    
                X509v3 Basic Constraints: 
                    CA:FALSE
                X509v3 CRL Distribution Points: 
    
                    Full Name:
                      URI:http://crl<span class="hljs-preprocessor">.globalsign</span><span class="hljs-preprocessor">.com</span>/gs/gsorganizationvalsha2g2<span class="hljs-preprocessor">.crl</span>
    
                X509v3 Subject Alternative Name: 
                    DNS:*<span class="hljs-preprocessor">.wikipedia</span><span class="hljs-preprocessor">.org</span>, DNS:*<span class="hljs-preprocessor">.m</span><span class="hljs-preprocessor">.mediawiki</span><span class="hljs-preprocessor">.org</span>, DNS:*<span class="hljs-preprocessor">.m</span><span class="hljs-preprocessor">.wikibooks</span><span class="hljs-preprocessor">.org</span>, DNS:*<span class="hljs-preprocessor">.m</span><span class="hljs-preprocessor">.wikidata</span><span class="hljs-preprocessor">.org</span>, DNS:*<span class="hljs-preprocessor">.m</span><span class="hljs-preprocessor">.wikimedia</span><span class="hljs-preprocessor">.org</span>, DNS:*<span class="hljs-preprocessor">.m</span><span class="hljs-preprocessor">.wikimediafoundation</span><span class="hljs-preprocessor">.org</span>, DNS:*<span class="hljs-preprocessor">.m</span><span class="hljs-preprocessor">.wikinews</span><span class="hljs-preprocessor">.org</span>, DNS:*<span class="hljs-preprocessor">.m</span><span class="hljs-preprocessor">.wikipedia</span><span class="hljs-preprocessor">.org</span>, DNS:*<span class="hljs-preprocessor">.m</span><span class="hljs-preprocessor">.wikiquote</span><span class="hljs-preprocessor">.org</span>, DNS:*<span class="hljs-preprocessor">.m</span><span class="hljs-preprocessor">.wikisource</span><span class="hljs-preprocessor">.org</span>, DNS:*<span class="hljs-preprocessor">.m</span><span class="hljs-preprocessor">.wikiversity</span><span class="hljs-preprocessor">.org</span>, DNS:*<span class="hljs-preprocessor">.m</span><span class="hljs-preprocessor">.wikivoyage</span><span class="hljs-preprocessor">.org</span>, DNS:*<span class="hljs-preprocessor">.m</span><span class="hljs-preprocessor">.wiktionary</span><span class="hljs-preprocessor">.org</span>, DNS:*<span class="hljs-preprocessor">.mediawiki</span><span class="hljs-preprocessor">.org</span>, DNS:*<span class="hljs-preprocessor">.planet</span><span class="hljs-preprocessor">.wikimedia</span><span class="hljs-preprocessor">.org</span>, DNS:*<span class="hljs-preprocessor">.wikibooks</span><span class="hljs-preprocessor">.org</span>, DNS:*<span class="hljs-preprocessor">.wikidata</span><span class="hljs-preprocessor">.org</span>, DNS:*<span class="hljs-preprocessor">.wikimedia</span><span class="hljs-preprocessor">.org</span>, DNS:*<span class="hljs-preprocessor">.wikimediafoundation</span><span class="hljs-preprocessor">.org</span>, DNS:*<span class="hljs-preprocessor">.wikinews</span><span class="hljs-preprocessor">.org</span>, DNS:*<span class="hljs-preprocessor">.wikiquote</span><span class="hljs-preprocessor">.org</span>, DNS:*<span class="hljs-preprocessor">.wikisource</span><span class="hljs-preprocessor">.org</span>, DNS:*<span class="hljs-preprocessor">.wikiversity</span><span class="hljs-preprocessor">.org</span>, DNS:*<span class="hljs-preprocessor">.wikivoyage</span><span class="hljs-preprocessor">.org</span>, DNS:*<span class="hljs-preprocessor">.wiktionary</span><span class="hljs-preprocessor">.org</span>, DNS:*<span class="hljs-preprocessor">.wmfusercontent</span><span class="hljs-preprocessor">.org</span>, DNS:*<span class="hljs-preprocessor">.zero</span><span class="hljs-preprocessor">.wikipedia</span><span class="hljs-preprocessor">.org</span>, DNS:mediawiki<span class="hljs-preprocessor">.org</span>, DNS:w<span class="hljs-preprocessor">.wiki</span>, DNS:wikibooks<span class="hljs-preprocessor">.org</span>, DNS:wikidata<span class="hljs-preprocessor">.org</span>, DNS:wikimedia<span class="hljs-preprocessor">.org</span>, DNS:wikimediafoundation<span class="hljs-preprocessor">.org</span>, DNS:wikinews<span class="hljs-preprocessor">.org</span>, DNS:wikiquote<span class="hljs-preprocessor">.org</span>, DNS:wikisource<span class="hljs-preprocessor">.org</span>, DNS:wikiversity<span class="hljs-preprocessor">.org</span>, DNS:wikivoyage<span class="hljs-preprocessor">.org</span>, DNS:wiktionary<span class="hljs-preprocessor">.org</span>, DNS:wmfusercontent<span class="hljs-preprocessor">.org</span>, DNS:wikipedia<span class="hljs-preprocessor">.org</span>
                X509v3 Extended Key Usage: 
                    TLS Web Server Authentication, TLS Web Client Authentication
                X509v3 Subject Key Identifier: 
                    <span class="hljs-number">28</span>:<span class="hljs-number">2</span>A:<span class="hljs-number">26</span>:<span class="hljs-number">2</span>A:<span class="hljs-number">57</span>:<span class="hljs-number">8</span>B:<span class="hljs-number">3</span>B:CE:B4:D6:AB:<span class="hljs-number">54</span>:EF:D7:<span class="hljs-number">38</span>:<span class="hljs-number">21</span>:<span class="hljs-number">2</span>C:<span class="hljs-number">49</span>:<span class="hljs-number">5</span>C:<span class="hljs-number">36</span>
                X509v3 Authority Key Identifier: 
                    keyid:<span class="hljs-number">96</span>:DE:<span class="hljs-number">61</span>:F1:BD:<span class="hljs-number">1</span>C:<span class="hljs-number">16</span>:<span class="hljs-number">29</span>:<span class="hljs-number">53</span>:<span class="hljs-number">1</span>C:C0:CC:<span class="hljs-number">7</span>D:<span class="hljs-number">3</span>B:<span class="hljs-number">83</span>:<span class="hljs-number">00</span>:<span class="hljs-number">40</span>:E6:<span class="hljs-number">1</span>A:<span class="hljs-number">7</span>C
    
        Signature Algorithm: sha256WithRSAEncryption
             <span class="hljs-number">8</span>b:c3:ed:d1:<span class="hljs-number">9</span>d:<span class="hljs-number">39</span>:<span class="hljs-number">6</span>f:af:<span class="hljs-number">40</span>:<span class="hljs-number">72</span>:bd:<span class="hljs-number">1</span>e:<span class="hljs-number">18</span>:<span class="hljs-number">5</span>e:<span class="hljs-number">30</span>:<span class="hljs-number">54</span>:<span class="hljs-number">23</span>:<span class="hljs-number">35</span>:
             ...</code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li><li style="color: rgb(153, 153, 153);">6</li><li style="color: rgb(153, 153, 153);">7</li><li style="color: rgb(153, 153, 153);">8</li><li style="color: rgb(153, 153, 153);">9</li><li style="color: rgb(153, 153, 153);">10</li><li style="color: rgb(153, 153, 153);">11</li><li style="color: rgb(153, 153, 153);">12</li><li style="color: rgb(153, 153, 153);">13</li><li style="color: rgb(153, 153, 153);">14</li><li style="color: rgb(153, 153, 153);">15</li><li style="color: rgb(153, 153, 153);">16</li><li style="color: rgb(153, 153, 153);">17</li><li style="color: rgb(153, 153, 153);">18</li><li style="color: rgb(153, 153, 153);">19</li><li style="color: rgb(153, 153, 153);">20</li><li style="color: rgb(153, 153, 153);">21</li><li style="color: rgb(153, 153, 153);">22</li><li style="color: rgb(153, 153, 153);">23</li><li style="color: rgb(153, 153, 153);">24</li><li style="color: rgb(153, 153, 153);">25</li><li style="color: rgb(153, 153, 153);">26</li><li style="color: rgb(153, 153, 153);">27</li><li style="color: rgb(153, 153, 153);">28</li><li style="color: rgb(153, 153, 153);">29</li><li style="color: rgb(153, 153, 153);">30</li><li style="color: rgb(153, 153, 153);">31</li><li style="color: rgb(153, 153, 153);">32</li><li style="color: rgb(153, 153, 153);">33</li><li style="color: rgb(153, 153, 153);">34</li><li style="color: rgb(153, 153, 153);">35</li><li style="color: rgb(153, 153, 153);">36</li><li style="color: rgb(153, 153, 153);">37</li><li style="color: rgb(153, 153, 153);">38</li><li style="color: rgb(153, 153, 153);">39</li><li style="color: rgb(153, 153, 153);">40</li><li style="color: rgb(153, 153, 153);">41</li><li style="color: rgb(153, 153, 153);">42</li><li style="color: rgb(153, 153, 153);">43</li><li style="color: rgb(153, 153, 153);">44</li><li style="color: rgb(153, 153, 153);">45</li><li style="color: rgb(153, 153, 153);">46</li><li style="color: rgb(153, 153, 153);">47</li><li style="color: rgb(153, 153, 153);">48</li><li style="color: rgb(153, 153, 153);">49</li><li style="color: rgb(153, 153, 153);">50</li><li style="color: rgb(153, 153, 153);">51</li><li style="color: rgb(153, 153, 153);">52</li><li style="color: rgb(153, 153, 153);">53</li></ul></pre>
    
    <p>To validate this end-entity certificate, one needs an intermediate certificate that matches its Issuer and Authority Key Identifier:</p>
    
    <ul>
    <li>Issuer    C=BE, O=GlobalSign nv-sa, CN=GlobalSign Organization Validation CA - SHA256 - G2</li>
    <li>Authority Key Identifier  96:DE:61:F1:BD:1C:16:29:53:1C:C0:CC:7D:3B:83:00:40:E6:1A:7C</li>
    </ul>
    
    <p>In a TLS connection, a properly-configured server would provide the intermediate as part of the handshake. However, it’s also possible to retrieve the intermediate certificate by fetching the “CA Issuers” URL from the end-entity certificate.</p>
    
    
    
    <h2 id="3-2-intermediate-certificate"><a name="t10"></a>3-2) Intermediate certificate</h2>
    
    <p>his is an example of an intermediate certificate belonging to a certificate authority. This certificate signed the end-entity certificate above, and was signed by the root certificate below. Note that the subject field of this intermediate certificate matches the issuer field of the end-entity certificate that it signed. Also, the “subject key identifier” field in the intermediate matches the “authority key identifier” field in the subject.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs mathematica has-numbering">Certificate:
        Data:
            <span class="hljs-keyword">Version</span>: <span class="hljs-number">3</span> (<span class="hljs-number">0x2</span>)
            Serial <span class="hljs-keyword">Number</span>:
                <span class="hljs-number">04</span>:<span class="hljs-number">00</span>:<span class="hljs-number">00</span>:<span class="hljs-number">00</span>:<span class="hljs-number">00</span>:<span class="hljs-number">01</span>:<span class="hljs-number">44</span>:<span class="hljs-number">4</span>e:f0:<span class="hljs-number">42</span>:<span class="hljs-number">47</span>
        <span class="hljs-keyword">Signature</span> Algorithm: sha256WithRSAEncryption
            Issuer: <span class="hljs-keyword">C</span>=BE, <span class="hljs-keyword">O</span>=GlobalSign nv-sa, OU=<span class="hljs-keyword">Root</span> CA, CN=GlobalSign <span class="hljs-keyword">Root</span> CA
            Validity
                <span class="hljs-keyword">Not</span> <span class="hljs-keyword">Before</span>: Feb <span class="hljs-number">20</span> <span class="hljs-number">10</span>:<span class="hljs-number">00</span>:<span class="hljs-number">00</span> <span class="hljs-number">2014</span> GMT
                <span class="hljs-keyword">Not</span> <span class="hljs-keyword">After</span> : Feb <span class="hljs-number">20</span> <span class="hljs-number">10</span>:<span class="hljs-number">00</span>:<span class="hljs-number">00</span> <span class="hljs-number">2024</span> GMT
            Subject: <span class="hljs-keyword">C</span>=BE, <span class="hljs-keyword">O</span>=GlobalSign nv-sa, CN=GlobalSign Organization Validation CA - SHA256 - G2
            Subject Public Key Info:
                Public Key Algorithm: rsaEncryption
                    Public-Key: (<span class="hljs-number">2048</span> bit)
                    <span class="hljs-keyword">Modulus</span>:
                        <span class="hljs-number">00</span>:c7:<span class="hljs-number">0</span>e:<span class="hljs-number">6</span>c:<span class="hljs-number">3</span>f:<span class="hljs-number">23</span>:<span class="hljs-number">93</span>:<span class="hljs-number">7</span>f:cc:<span class="hljs-number">70</span>:a5:<span class="hljs-number">9</span>d:<span class="hljs-number">20</span>:c3:<span class="hljs-number">0</span>e:
                        ...
                    <span class="hljs-keyword">Exponent</span>: <span class="hljs-number">65537</span> (<span class="hljs-number">0x10001</span>)
            X509v3 extensions:
                X509v3 Key Usage: critical
                    Certificate <span class="hljs-keyword">Sign</span>, CRL <span class="hljs-keyword">Sign</span>
                X509v3 Basic Constraints: critical
                    CA:TRUE, pathlen:<span class="hljs-number">0</span>
                X509v3 Subject Key Identifier:
                    <span class="hljs-number">96</span>:DE:<span class="hljs-number">61</span>:F1:BD:<span class="hljs-number">1</span><span class="hljs-keyword">C</span>:<span class="hljs-number">16</span>:<span class="hljs-number">29</span>:<span class="hljs-number">53</span>:<span class="hljs-number">1</span><span class="hljs-keyword">C</span>:C0:CC:<span class="hljs-number">7</span><span class="hljs-keyword">D</span>:<span class="hljs-number">3</span>B:<span class="hljs-number">83</span>:<span class="hljs-number">00</span>:<span class="hljs-number">40</span>:E6:<span class="hljs-number">1</span>A:<span class="hljs-number">7</span><span class="hljs-keyword">C</span>
                X509v3 Certificate Policies:
                    Policy: X509v3 Any Policy
                      CPS: https://www.globalsign.com/repository/
    
                X509v3 CRL Distribution Points:
    
                    <span class="hljs-keyword">Full</span> Name:
                      URI:http://crl.globalsign.net/root.crl
    
                Authority <span class="hljs-keyword">Information</span> Access:
                    OCSP - URI:http://ocsp.globalsign.com/rootr1
    
                X509v3 Authority Key Identifier:
                    keyid:<span class="hljs-number">60</span>:<span class="hljs-number">7</span>B:<span class="hljs-number">66</span>:<span class="hljs-number">1</span>A:<span class="hljs-number">45</span>:<span class="hljs-number">0</span><span class="hljs-keyword">D</span>:<span class="hljs-number">97</span>:CA:<span class="hljs-number">89</span>:<span class="hljs-number">50</span>:<span class="hljs-number">2</span>F:<span class="hljs-number">7</span><span class="hljs-keyword">D</span>:<span class="hljs-number">04</span>:CD:<span class="hljs-number">34</span>:A8:FF:FC:FD:<span class="hljs-number">4</span>B
    
        <span class="hljs-keyword">Signature</span> Algorithm: sha256WithRSAEncryption
             <span class="hljs-number">46</span>:<span class="hljs-number">2</span>a:ee:<span class="hljs-number">5</span>e:bd:ae:<span class="hljs-number">01</span>:<span class="hljs-number">60</span>:<span class="hljs-number">37</span>:<span class="hljs-number">31</span>:<span class="hljs-number">11</span>:<span class="hljs-number">86</span>:<span class="hljs-number">71</span>:<span class="hljs-number">74</span>:b6:<span class="hljs-number">46</span>:<span class="hljs-number">49</span>:c8:
             ...</code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li><li style="color: rgb(153, 153, 153);">6</li><li style="color: rgb(153, 153, 153);">7</li><li style="color: rgb(153, 153, 153);">8</li><li style="color: rgb(153, 153, 153);">9</li><li style="color: rgb(153, 153, 153);">10</li><li style="color: rgb(153, 153, 153);">11</li><li style="color: rgb(153, 153, 153);">12</li><li style="color: rgb(153, 153, 153);">13</li><li style="color: rgb(153, 153, 153);">14</li><li style="color: rgb(153, 153, 153);">15</li><li style="color: rgb(153, 153, 153);">16</li><li style="color: rgb(153, 153, 153);">17</li><li style="color: rgb(153, 153, 153);">18</li><li style="color: rgb(153, 153, 153);">19</li><li style="color: rgb(153, 153, 153);">20</li><li style="color: rgb(153, 153, 153);">21</li><li style="color: rgb(153, 153, 153);">22</li><li style="color: rgb(153, 153, 153);">23</li><li style="color: rgb(153, 153, 153);">24</li><li style="color: rgb(153, 153, 153);">25</li><li style="color: rgb(153, 153, 153);">26</li><li style="color: rgb(153, 153, 153);">27</li><li style="color: rgb(153, 153, 153);">28</li><li style="color: rgb(153, 153, 153);">29</li><li style="color: rgb(153, 153, 153);">30</li><li style="color: rgb(153, 153, 153);">31</li><li style="color: rgb(153, 153, 153);">32</li><li style="color: rgb(153, 153, 153);">33</li><li style="color: rgb(153, 153, 153);">34</li><li style="color: rgb(153, 153, 153);">35</li><li style="color: rgb(153, 153, 153);">36</li><li style="color: rgb(153, 153, 153);">37</li><li style="color: rgb(153, 153, 153);">38</li><li style="color: rgb(153, 153, 153);">39</li><li style="color: rgb(153, 153, 153);">40</li><li style="color: rgb(153, 153, 153);">41</li><li style="color: rgb(153, 153, 153);">42</li><li style="color: rgb(153, 153, 153);">43</li></ul></pre>
    
    
    
    <h2 id="3-3-root-certificate"><a name="t11"></a>3-3) Root certificate</h2>
    
    <p>This is an example of a self-signed root certificate representing a certificate authority. Its issuer and subject fields are the same, and its signature can be validated with its own public key. Validation of the trust chain has to end here. If the validating program has this root certificate in its trust store, the end-entity certificate can be considered trusted for use in a TLS connection. Otherwise, the end-entity certificate is considered untrusted.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs mathematica has-numbering">Certificate:
        Data:
            <span class="hljs-keyword">Version</span>: <span class="hljs-number">3</span> (<span class="hljs-number">0x2</span>)
            Serial <span class="hljs-keyword">Number</span>:
                <span class="hljs-number">04</span>:<span class="hljs-number">00</span>:<span class="hljs-number">00</span>:<span class="hljs-number">00</span>:<span class="hljs-number">00</span>:<span class="hljs-number">01</span>:<span class="hljs-number">15</span>:<span class="hljs-number">4</span>b:<span class="hljs-number">5</span>a:c3:<span class="hljs-number">94</span>
        <span class="hljs-keyword">Signature</span> Algorithm: sha1WithRSAEncryption
            Issuer: <span class="hljs-keyword">C</span>=BE, <span class="hljs-keyword">O</span>=GlobalSign nv-sa, OU=<span class="hljs-keyword">Root</span> CA, CN=GlobalSign <span class="hljs-keyword">Root</span> CA
            Validity
                <span class="hljs-keyword">Not</span> <span class="hljs-keyword">Before</span>: Sep  <span class="hljs-number">1</span> <span class="hljs-number">12</span>:<span class="hljs-number">00</span>:<span class="hljs-number">00</span> <span class="hljs-number">1998</span> GMT
                <span class="hljs-keyword">Not</span> <span class="hljs-keyword">After</span> : Jan <span class="hljs-number">28</span> <span class="hljs-number">12</span>:<span class="hljs-number">00</span>:<span class="hljs-number">00</span> <span class="hljs-number">2028</span> GMT
            Subject: <span class="hljs-keyword">C</span>=BE, <span class="hljs-keyword">O</span>=GlobalSign nv-sa, OU=<span class="hljs-keyword">Root</span> CA, CN=GlobalSign <span class="hljs-keyword">Root</span> CA
            Subject Public Key Info:
                Public Key Algorithm: rsaEncryption
                    Public-Key: (<span class="hljs-number">2048</span> bit)
                    <span class="hljs-keyword">Modulus</span>:
                        <span class="hljs-number">00</span>:da:<span class="hljs-number">0</span>e:e6:<span class="hljs-number">99</span>:<span class="hljs-number">8</span>d:ce:a3:e3:<span class="hljs-number">4</span>f:<span class="hljs-number">8</span>a:<span class="hljs-number">7</span>e:fb:f1:<span class="hljs-number">8</span>b:
                        ...
                    <span class="hljs-keyword">Exponent</span>: <span class="hljs-number">65537</span> (<span class="hljs-number">0x10001</span>)
            X509v3 extensions:
                X509v3 Key Usage: critical
                    Certificate <span class="hljs-keyword">Sign</span>, CRL <span class="hljs-keyword">Sign</span>
                X509v3 Basic Constraints: critical
                    CA:TRUE
                X509v3 Subject Key Identifier: 
                    <span class="hljs-number">60</span>:<span class="hljs-number">7</span>B:<span class="hljs-number">66</span>:<span class="hljs-number">1</span>A:<span class="hljs-number">45</span>:<span class="hljs-number">0</span><span class="hljs-keyword">D</span>:<span class="hljs-number">97</span>:CA:<span class="hljs-number">89</span>:<span class="hljs-number">50</span>:<span class="hljs-number">2</span>F:<span class="hljs-number">7</span><span class="hljs-keyword">D</span>:<span class="hljs-number">04</span>:CD:<span class="hljs-number">34</span>:A8:FF:FC:FD:<span class="hljs-number">4</span>B
        <span class="hljs-keyword">Signature</span> Algorithm: sha1WithRSAEncryption
             d6:<span class="hljs-number">73</span>:e7:<span class="hljs-number">7</span>c:<span class="hljs-number">4</span>f:<span class="hljs-number">76</span>:d0:<span class="hljs-number">8</span>d:bf:ec:ba:a2:be:<span class="hljs-number">34</span>:c5:<span class="hljs-number">28</span>:<span class="hljs-number">32</span>:b5:
             ...
    </code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li><li style="color: rgb(153, 153, 153);">6</li><li style="color: rgb(153, 153, 153);">7</li><li style="color: rgb(153, 153, 153);">8</li><li style="color: rgb(153, 153, 153);">9</li><li style="color: rgb(153, 153, 153);">10</li><li style="color: rgb(153, 153, 153);">11</li><li style="color: rgb(153, 153, 153);">12</li><li style="color: rgb(153, 153, 153);">13</li><li style="color: rgb(153, 153, 153);">14</li><li style="color: rgb(153, 153, 153);">15</li><li style="color: rgb(153, 153, 153);">16</li><li style="color: rgb(153, 153, 153);">17</li><li style="color: rgb(153, 153, 153);">18</li><li style="color: rgb(153, 153, 153);">19</li><li style="color: rgb(153, 153, 153);">20</li><li style="color: rgb(153, 153, 153);">21</li><li style="color: rgb(153, 153, 153);">22</li><li style="color: rgb(153, 153, 153);">23</li><li style="color: rgb(153, 153, 153);">24</li><li style="color: rgb(153, 153, 153);">25</li><li style="color: rgb(153, 153, 153);">26</li><li style="color: rgb(153, 153, 153);">27</li><li style="color: rgb(153, 153, 153);">28</li><li style="color: rgb(153, 153, 153);">29</li></ul></pre>
    
    
    
    <h1 id="4-security"><a name="t12"></a>4)    Security</h1>
    
    <p>There are a number of publications about PKI problems by Bruce Schneier, Peter Gutmann and other security experts.</p>
    
    
    
    <h2 id="4-1-architectural-weaknesses"><a name="t13"></a>4-1) Architectural weaknesses</h2>
    
    <ul>
    <li>Use of blacklisting invalid certificates (using CRLs and OCSP), <br>
    <ul><li>If the client only trusts certificates when CRLs are available, then they lose the offline capability that makes PKI attractive. So most clients do trust certificates when CRLs are not available, but in that case an attacker that controls the communication channel can disable the CRLs. Adam Langley of Google has said soft-fail CRL checks are like a safety belt that works except when you are having an accident.[17]</li></ul></li>
    <li>CRLs are notably a poor choice because of large sizes and convoluted distribution patterns,</li>
    <li>Ambiguous OCSP semantics and lack of historical revocation status,</li>
    <li>Revocation of root certificates is not addressed,</li>
    <li>Aggregation problem: Identity claims (authenticate with an identifier), attribute claims (submit a bag of vetted attributes), and policy claims are combined in a single container. This raises privacy, policy mapping, and maintenance issues,</li>
    <li>Delegation problem: CAs cannot technically restrict subordinate CAs from issuing certificates outside a limited namespaces or attribute set; this feature of X.509 is not in use. Therefore, a large number of CAs exist on the Internet, and classifying them and their policies is an insurmountable task. Delegation of authority within an organization cannot be handled at all, as in common business practice.</li>
    <li>Federation problem: Certificate chains that are the result of subordinate CAs, bridge CAs, and cross-signing make validation complex and expensive in terms of processing time. Path validation semantics may be ambiguous. The hierarchy with a third-party trusted party is the only model. This is inconvenient when a bilateral trust relationship is already in place.</li>
    <li>Issuance of an Extended Validation (EV) certificate for a hostname doesn’t prevent issuance of a lower-validation certificate valid for the same hostname, which means that the higher validation level of EV doesn’t protect against man-in-the-middle attacks.[18]</li>
    </ul>
    
    
    
    <h2 id="4-2-problems-with-certificate-authorities"><a name="t14"></a>4-2) Problems with certificate authorities</h2>
    
    <ul>
    <li>The subject, not the relying party, purchases certificates. The subject will often utilize the cheapest issuer, so quality is not being paid for in the competing market. This is partly addressed by Extended Validation certificates.</li>
    <li>Certification authorities deny almost all warranties to the user (including subject or even relying parties).</li>
    <li>The expiration date should be used to limit the time the key strength is deemed sufficient. This parameter is abused by certification authorities to charge the client an extension fee. This places an unnecessary burden on the user with key roll-over.</li>
    <li>“Users use an undefined certification request protocol to obtain a certificate which is published in an unclear location in a nonexistent directory with no real means to revoke it.” [16]</li>
    <li>Like all businesses, CAs are subject to the legal jurisdiction(s) of their site(s) of operation, and may be legally compelled to compromise the interests of their customers and their users. Intelligence agencies have also made use of false certificates issued through extralegal compromise of CAs, such as DigiNotar, to carry out man-in-the-middle attacks.[citation needed] Another example is a revocation request of the CA of the Dutch government, because of a new Dutch law becoming active starting January 1, 2018, giving new powers for the Dutch intelligence and security services.[19]</li>
    </ul>
    
    
    
    <h2 id="4-3-implementation-issues"><a name="t15"></a>4-3) Implementation issues</h2>
    
    <p>Implementations suffer from design flaws, bugs, different interpretations of standards and lack of interoperability of different standards. Some problems are:[citation needed]</p>
    
    <ul>
    <li>Many implementations turn off revocation check: <br>
    <ul><li>Seen as obstacle, policies are not enforced</li>
    <li>If it was turned on in all browsers by default, including code signing, it would probably crash the infrastructure[citation needed].</li></ul></li>
    <li>DNs are complex and little understood (lack of canonicalization, internationalization problems, ..)</li>
    <li>rfc822Name has two notations</li>
    <li>Name and policy constraints hardly supported</li>
    <li>Key usage ignored, first certificate in a list being used</li>
    <li>Enforcement of custom OIDs is difficult</li>
    <li>Attributes should not be made critical because it makes clients crash.</li>
    <li>Unspecified length of attributes lead to product-specific limits</li>
    <li>There are implementation errors with X.509 that allow e.g. falsified subject names using null-terminated strings[20] or code injection attacks in certificates.</li>
    <li>By using illegal[21] 0x80 padded subidentifiers of object identifiers, wrong implementations or by using integer overflows of the client’s browsers, an attacker can include an unknown attribute in the CSR, which the CA will sign, which the client wrongly interprets as “CN” (OID=2.5.4.3). Dan Kaminsky at the 26th Chaos Communication Congress “Black OPs of PKI”[22]</li>
    </ul>
    
    
    
    <h2 id="4-4-cryptographic-weaknesses"><a name="t16"></a>4-4) Cryptographic weaknesses</h2>
    
    <p>Digital signature systems depend on secure cryptographic hash functions to work. When a public key infrastructure allows the use of a hash function that is no longer secure, an attacker can exploit weaknesses in the hash function to forge certificates. Specifically, if an attacker is able to produce a hash collision, they can convince a CA to sign a certificate with innocuous contents, where the hash of those contents is identical to the hash of another, malicious set of certificate contents, created by the attacker with values of their choosing. The attacker can then append the CA-provided signature to their malicious certificate contents, resulting in a malicious certificate that appears to be signed by the CA. Because the malicious certificate contents are chosen solely by the attacker, they can have different validity dates or hostnames than the innocuous certificate. The malicious certificate can even contain a “CA: true” field making it able to issue further trusted certificates.</p>
    
    <ul>
    <li>MD2-based certificates were used for a long time and were vulnerable to preimage attacks. Since the root certificate already had a self-signature, attackers could use this signature and use it for an intermediate certificate.</li>
    <li>In 2005, Arjen Lenstra and Benne de Weger demonstrated “how to use hash collisions to construct two X.509 certificates that contain identical signatures and that differ only in the public keys”, achieved using a collision attack on the MD5 hash function.[23]</li>
    <li>In 2008, Alexander Sotirov and Marc Stevens presented at the Chaos Communication Congress a practical attack that allowed them to create a rogue Certificate Authority, accepted by all common browsers, by exploiting the fact that RapidSSL was still issuing X.509 certificates based on MD5.[24]</li>
    <li>In April 2009 at the Eurocrypt Conference,[25] Australian Researchers of Macquarie University presented “Automatic Differential Path Searching for SHA-1”.[26] The researchers were able to deduce a method which increases the likelihood of a collision by several orders of magnitude.[27]</li>
    <li>In February 2017, a group of researchers produced a SHA-1 collision, demonstrating SHA-1’s weakness.</li>
    </ul>
    
    
    
    <h3 id="4-4-1-mitigations-for-cryptographic-weaknesses"><a name="t17"></a>4-4-1)  Mitigations for cryptographic weaknesses</h3>
    
    <p>Exploiting a hash collision to forge X.509 signatures requires that the attacker be able to predict the data that the certificate authority will sign. This can be somewhat mitigated by the CA generating a random component in the certificates it signs, typically the serial number. The CA/Browser Forum has required serial number entropy in its Baseline Requirements Section 7.1 since 2011.[29]</p>
    
    <p>As of January 1, 2016, the Baseline Requirements forbid issuance of certificates using SHA-1. As of early 2017, Chrome[30] and Firefox[31] reject certificates that use SHA-1. As of May 2017 both Edge[32] and Safari [33] are also rejecting SHA-1 certificate. Non-browser X.509 validators do not yet reject SHA-1 certificates.[34]</p>
    
    
    
    <h1 id="5-pkcs-standards-summary"><a name="t18"></a>5) PKCS Standards Summary</h1>
    
    <p>In cryptography, PKCS stands for “Public Key Cryptography Standards”. These are a group of public-key cryptography standards devised and published by RSA Security Inc, starting in the early 1990s. The company published the standards to promote the use of the cryptography techniques to which they had patents, such as the RSA algorithm, the Schnorr signature algorithm and several others. Though not industry standards (because the company retained control over them), some of the standards in recent years[when?] have begun to move into the “standards-track” processes of relevant standards organizations such as the IETF and the PKIX working-group.</p>
    
    <ul>
    <li><p>PKCS #1   2.2 RSA Cryptography Standard[1]    See RFC 8017. Defines the mathematical properties and format of RSA public and private keys (ASN.1-encoded in clear-text), and the basic algorithms and encoding/padding schemes for performing RSA encryption, decryption, and producing and verifying signatures.</p></li>
    <li><p>PKCS #2   -   Withdrawn   No longer active as of 2010. Covered RSA encryption of message digests; subsequently merged into PKCS #1.</p></li>
    <li><p>PKCS #3   1.4 Diffie–Hellman Key Agreement Standard[2]    A cryptographic protocol that allows two parties that have no prior knowledge of each other to jointly establish a shared secret key over an insecure communications channel.</p></li>
    <li><p>PKCS #4   -   Withdrawn   No longer active as of 2010. Covered RSA key syntax; subsequently merged into PKCS #1.</p></li>
    <li><p>PKCS #5   2.1 Password-based Encryption Standard[3]   See RFC 8018 and PBKDF2.</p></li>
    <li><p>PKCS #6   1.5 Extended-Certificate Syntax Standard[4] Defines extensions to the old v1 X.509 certificate specification. Obsoleted by v3 of the same.</p></li>
    <li><p>PKCS #7   1.5 Cryptographic Message Syntax Standard[5]    See RFC 2315. Used to sign and/or encrypt messages under a PKI. Used also for certificate dissemination (for instance as a response to a PKCS #10 message). Formed the basis for S/MIME, which is as of 2010 based on RFC 5652, an updated Cryptographic Message Syntax Standard (CMS). Often used for single sign-on.</p></li>
    <li><p>PKCS #8   1.2 Private-Key Information Syntax Standard[6]  See RFC 5958. Used to carry private certificate keypairs (encrypted or unencrypted).</p></li>
    <li><p>PKCS #9   2.0 Selected Attribute Types[7] See RFC 2985. Defines selected attribute types for use in PKCS #6 extended certificates, PKCS #7 digitally signed messages, PKCS #8 private-key information, and PKCS #10 certificate-signing requests.</p></li>
    <li><p>PKCS #10  1.7 Certification Request Standard[8]   See RFC 2986. Format of messages sent to a certification authority to request certification of a public key. See certificate signing request.</p></li>
    <li><p>PKCS #11  2.40    Cryptographic Token Interface[9]    Also known as “Cryptoki”. An API defining a generic interface to cryptographic tokens (see also hardware security module). Often used in single sign-on, public-key cryptography and disk encryption[10] systems. RSA Security has turned over further development of the PKCS #11 standard to the OASIS PKCS 11 Technical Committee.</p></li>
    <li><p>PKCS #12  1.1 Personal Information Exchange Syntax Standard[11]   See RFC 7292. Defines a file format commonly used to store private keys with accompanying public key certificates, protected with a password-based symmetric key. PFX is a predecessor to PKCS #12. <br>
    This container format can contain multiple embedded objects, such as multiple certificates. Usually protected/encrypted with a password. Usable as a format for the Java key store and to establish client authentication certificates in Mozilla Firefox. Usable by Apache Tomcat.</p></li>
    <li><p>PKCS #13  –   Elliptic Curve Cryptography Standard    (Apparently abandoned, only reference is a proposal from 1998.)[12]</p></li>
    <li><p>PKCS #14  –   Pseudo-random Number Generation (Apparently abandoned, no documents exist.)</p></li>
    <li><p>PKCS #15  1.1 Cryptographic Token Information Format Standard[13] Defines a standard allowing users of cryptographic tokens to identify themselves to applications, independent of the application’s Cryptoki implementation (PKCS #11) or other API. RSA has relinquished IC-card-related parts of this standard to ISO/IEC 7816-15.[14]</p></li>
    </ul>
    
    
    
    <h1 id="6-openssl-certificate-authority"><a name="t19"></a>6) OpenSSL Certificate Authority</h1>
    
    <p>This guide demonstrates how to act as your own certificate authority (CA) using the OpenSSL command-line tools. This is useful in a number of situations, such as issuing server certificates to secure an intranet website, or for issuing certificates to clients to allow them to authenticate to a sever.</p>
    
    
    
    <h2 id="6-1-introduction"><a name="t20"></a>6-1) Introduction</h2>
    
    <p>OpenSSL is a free and open-source cryptographic library that provides several command-line tools for handling digital certificates. Some of these tools can be act as a Certificate Authority</p>
    
    <p>A certificate authority is an entity that sgins digital certificates. Many websites need to let their customers know that the connection is secure <br>
    , so they pay an international Certificate Authority (CA) to sign a certificate for their domain.</p>
    
    <p>In some cases it may make more sense to act as your own CA, rather than paying a CA like DigiCert. Common cases include securing an intranet website, or for issuing certificate to clients to allow them to authenticate to a server.</p>
    
    
    
    <h2 id="6-2-create-the-root-pair"><a name="t21"></a>6-2) Create the root pair</h2>
    
    <p>Acting as a certificate authority means dealing with cryptograhic pair of private keys and public certificates. The very first cryptographic pair we’ll create is the root pair. This consists of the root key (ca.key.pem) and root certificate (ca.cert.pem). This pair forms the identity of your CA.</p>
    
    <p>Typically, the root CA does not sign server or client certificate directly. The root CA is only ever used to create one or more intermediate CAs, which are trusted by the root CA to sign certificate on their behalf. This is best practice. It allows the root key to be kept offline and unused as much as possible, as any compromise of the root is disastrous.</p>
    
    <blockquote>
      <p>Note:</p>
      
      <p>It’s best practice to create the root pair in a secure environment. Ideally, <br>
      this should be on a fully encrypted, air gapped computer that is permanently isolated from the Internet. Remove the wireless card and fill the ethernet with glue.</p>
    </blockquote>
    
    
    
    <h3 id="6-2-1prepare-the-directory"><a name="t22"></a>6-2-1)Prepare the directory</h3>
    
    <p>Choose a directoy to store all keys and certificates.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs perl has-numbering"><span class="hljs-keyword">mkdir</span> /root/ca</code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li></ul></pre>
    
    <p>Create the directory structure. The <code>index.txt</code> and <code>serial</code> files act as a flat file database to keep track of signed certificates.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs php has-numbering">cd /root/ca
    mkdir certs crl newcerts <span class="hljs-keyword">private</span>
    chmod <span class="hljs-number">700</span> <span class="hljs-keyword">private</span>
    touch index.txt
    <span class="hljs-keyword">echo</span> <span class="hljs-number">1000</span> &gt; serial</code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li></ul></pre>
    
    
    
    <h3 id="6-2-2-prepare-the-configuration-file"><a name="t23"></a>6-2-2) Prepare the configuration file</h3>
    
    <p>You must create a configuration file for OpenSSL to use. Copy the root CA configuration file from the Appendix to <code>/root/ca/openssl.cnf</code>.</p>
    
    <p>The <code>[ca]</code> section is mandatory. Here we tell OpenSSL to use the options from the <code>[CA_default]</code> section.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs autohotkey has-numbering">[ca]
    # <span class="hljs-escape">`m</span>an ca<span class="hljs-escape">`
    </span>default_ca = C<span class="hljs-built_in">A_default</span></code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li></ul></pre>
    
    <p>The <code>[CA_default]</code> section contains a range of defaults. Make sure you declare the directory you chose earlier(/root/ca).</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs makefile has-numbering">[CA_defalut]
    <span class="hljs-comment"># Directory and file lcations.</span>
    <span class="hljs-constant">dir</span>                 = /root/ca
    <span class="hljs-constant">certs</span>               = $dir/certs
    <span class="hljs-constant">crl_dir</span>         = $dir/crl
    <span class="hljs-constant">new_certs_dir</span>       = $dir/newcerts
    <span class="hljs-constant">database</span>            = $dir/index.txt
    <span class="hljs-constant">serial</span>              = $dir/serial
    <span class="hljs-constant">RANDFILE</span>            = $dir/private/.rand
    
    <span class="hljs-comment"># The root key and root certificate.</span>
    <span class="hljs-constant">private_key</span>         = $dir/private/ca.key.pem
    <span class="hljs-constant">certificate</span>     = $dir/certs/ca.cert.pem
    
    <span class="hljs-comment"># For certificate revocation lists</span>
    <span class="hljs-constant">crlnumber</span>           = $dir/crlnumber
    <span class="hljs-constant">crl</span>                 = $dir/crl/ca.crl.pem
    <span class="hljs-constant">crl_extension</span>       = crl_ext
    <span class="hljs-constant">default_crl_days</span>    = 30
    
    <span class="hljs-comment"># SHA-1 is deprecated, so use SHA-2 instead.</span>
    <span class="hljs-constant">defualt_md</span>      = sha256
    
    <span class="hljs-constant">name_opt</span>            = ca_default
    <span class="hljs-constant">cert_opt</span>            = ca_default
    <span class="hljs-constant">default_days</span>        = 375
    <span class="hljs-constant">preserve</span>            = no
    <span class="hljs-constant">policy</span>              = plicy_strict
    </code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li><li style="color: rgb(153, 153, 153);">6</li><li style="color: rgb(153, 153, 153);">7</li><li style="color: rgb(153, 153, 153);">8</li><li style="color: rgb(153, 153, 153);">9</li><li style="color: rgb(153, 153, 153);">10</li><li style="color: rgb(153, 153, 153);">11</li><li style="color: rgb(153, 153, 153);">12</li><li style="color: rgb(153, 153, 153);">13</li><li style="color: rgb(153, 153, 153);">14</li><li style="color: rgb(153, 153, 153);">15</li><li style="color: rgb(153, 153, 153);">16</li><li style="color: rgb(153, 153, 153);">17</li><li style="color: rgb(153, 153, 153);">18</li><li style="color: rgb(153, 153, 153);">19</li><li style="color: rgb(153, 153, 153);">20</li><li style="color: rgb(153, 153, 153);">21</li><li style="color: rgb(153, 153, 153);">22</li><li style="color: rgb(153, 153, 153);">23</li><li style="color: rgb(153, 153, 153);">24</li><li style="color: rgb(153, 153, 153);">25</li><li style="color: rgb(153, 153, 153);">26</li><li style="color: rgb(153, 153, 153);">27</li><li style="color: rgb(153, 153, 153);">28</li><li style="color: rgb(153, 153, 153);">29</li></ul></pre>
    
    <p>We’ll apply <code>policy_strict</code> for all root CA signatures, as the root CA is only being used to create intermediate CAs.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs makefile has-numbering">[ policy_strict]
    <span class="hljs-comment"># The root CA should only sign intermediate certificates that match.</span>
    <span class="hljs-comment"># See the POLICY FORMAT section of `man ca`.</span>
    <span class="hljs-constant">countryName</span>             = match
    <span class="hljs-constant">stateOrProvinceName</span>     = match
    <span class="hljs-constant">organizationName</span>            = match
    <span class="hljs-constant">organizationalUnitName</span>  = optional
    <span class="hljs-constant">commonName</span>              = supplied
    <span class="hljs-constant">emailAddress</span>                = optional</code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li><li style="color: rgb(153, 153, 153);">6</li><li style="color: rgb(153, 153, 153);">7</li><li style="color: rgb(153, 153, 153);">8</li><li style="color: rgb(153, 153, 153);">9</li></ul></pre>
    
    <p>We’ll apply <code>policy_loose</code> for all intermediate CA signatures, as the intermediate CA is signing server and client certifcate that may come from a variety of third-parties.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs makefile has-numbering">[ policy_loose ]
    <span class="hljs-comment"># Allow the intermediate CA to sign a more diverse range of certificates.</span>
    <span class="hljs-comment"># See the POLICY FORMAT section of the `ca` man page.</span>
    <span class="hljs-constant">countryName</span>             = optional
    <span class="hljs-constant">stateOrProvinceName</span>     = optional
    <span class="hljs-constant">localityName</span>            = optional
    <span class="hljs-constant">organizationName</span>        = optional
    <span class="hljs-constant">organizationalUnitName</span>  = optional
    <span class="hljs-constant">commonName</span>              = supplied
    <span class="hljs-constant">emailAddress</span>            = optional</code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li><li style="color: rgb(153, 153, 153);">6</li><li style="color: rgb(153, 153, 153);">7</li><li style="color: rgb(153, 153, 153);">8</li><li style="color: rgb(153, 153, 153);">9</li><li style="color: rgb(153, 153, 153);">10</li></ul></pre>
    
    <p>Options from te <code>[req]</code> section are applied when creating certificates or certificate signing requests.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs makefile has-numbering">[ req ]
    <span class="hljs-comment"># options for the `req` tool (`man req`).</span>
    <span class="hljs-constant">default_bits</span>                = 2048
    <span class="hljs-constant">distinguished_name</span>      = req_distinguished_name
    <span class="hljs-constant">string_mask</span>             = utf8only
    
    <span class="hljs-comment"># SHA-1 is deprecated, so use SHA-2 instead.</span>
    <span class="hljs-constant">default_md</span>          = sha256
    
    <span class="hljs-comment"># Extension to add when the -x509 option is used.</span>
    <span class="hljs-constant">x509_extensions</span>     = v3_ca</code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li><li style="color: rgb(153, 153, 153);">6</li><li style="color: rgb(153, 153, 153);">7</li><li style="color: rgb(153, 153, 153);">8</li><li style="color: rgb(153, 153, 153);">9</li><li style="color: rgb(153, 153, 153);">10</li><li style="color: rgb(153, 153, 153);">11</li></ul></pre>
    
    <p>The <code>[ req_distinguished_name ]</code> section declares the information normally required in a certificate signing request. You can optionally specify some defaults.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs makefile has-numbering">[ req_distinguished_name ]
    <span class="hljs-comment"># See &lt;https://en.wikipedia.org/wiki/Certificate_signing_request&gt;.</span>
    <span class="hljs-constant">countryName</span>                     = Country Name (2 letter code)
    <span class="hljs-constant">stateOrProvinceName</span>             = State or Province Name
    <span class="hljs-constant">localityName</span>                    = Locality Name
    0.organizationName              = Organization Name
    <span class="hljs-constant">organizationalUnitName</span>          = Organizational Unit Name
    <span class="hljs-constant">commonName</span>                      = Common Name
    <span class="hljs-constant">emailAddress</span>                    = Email Address
    
    <span class="hljs-comment"># Optionally, specify some defaults.</span>
    <span class="hljs-constant">countryName_default</span>             = GB
    <span class="hljs-constant">stateOrProvinceName_default</span>     = England
    <span class="hljs-constant">localityName_default</span>            =
    0.organizationName_default      = Alice Ltd
    <span class="hljs-comment">#organizationalUnitName_default =</span>
    <span class="hljs-comment">#emailAddress_default           =</span></code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li><li style="color: rgb(153, 153, 153);">6</li><li style="color: rgb(153, 153, 153);">7</li><li style="color: rgb(153, 153, 153);">8</li><li style="color: rgb(153, 153, 153);">9</li><li style="color: rgb(153, 153, 153);">10</li><li style="color: rgb(153, 153, 153);">11</li><li style="color: rgb(153, 153, 153);">12</li><li style="color: rgb(153, 153, 153);">13</li><li style="color: rgb(153, 153, 153);">14</li><li style="color: rgb(153, 153, 153);">15</li><li style="color: rgb(153, 153, 153);">16</li><li style="color: rgb(153, 153, 153);">17</li></ul></pre>
    
    <p>The next few sections are extensions that can be applied when signing certificates. For example, passing the <code>-extensions v3_ca</code> command-line argument will apply the options set in <code>[ v3_ca ]</code>.</p>
    
    <p>We’ll apply the <code>[ v3_ca ]</code> extension when we create the root certificate.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs makefile has-numbering">[ v3_ca ]
    <span class="hljs-comment"># Extensions for a typical CA (`man x509v3_config`).</span>
    <span class="hljs-constant">subjectKeyIdentifier</span>            = hash
    <span class="hljs-constant">autorityKeyIdentifier</span>           = keyid:always,issuer
    <span class="hljs-constant">basicConstraints</span>                    = critical, CA:true
    <span class="hljs-constant">keyUsage</span>                            = critical, digitalSignature, cRLsign, keyCertSign</code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li><li style="color: rgb(153, 153, 153);">6</li></ul></pre>
    
    <p>We’ll apply the <code>v3_ca_intermediate</code> extension when we create the intermediate certificate. <code>pathlen:0</code> ensuers that there can be no further certificate authorities below the intermediate CA.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs makefile has-numbering">[ v3_intermediate_ca ]
    <span class="hljs-comment"># Extensions for a typical intermediate CA (`man x509v3_config`).</span>
    <span class="hljs-constant">subjectKeyIdentifier</span> = hash
    <span class="hljs-constant">authorityKeyIdentifier</span> = keyid:always,issuer
    <span class="hljs-constant">basicConstraints</span> = critical, CA:true, pathlen:0
    <span class="hljs-constant">keyUsage</span> = critical, digitalSignature, cRLSign, keyCertSign</code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li><li style="color: rgb(153, 153, 153);">6</li></ul></pre>
    
    <p>We’ll apply the server_cert extension when signing server certificates, such as those used for web servers.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs makefile has-numbering">[ server_cert ]
    <span class="hljs-comment"># Extensions for server certificates (`man x509v3_config`).</span>
    <span class="hljs-constant">basicConstraints</span> = CA:FALSE
    <span class="hljs-constant">nsCertType</span> = server
    <span class="hljs-constant">nsComment</span> = "OpenSSL Generated Server Certificate"
    <span class="hljs-constant">subjectKeyIdentifier</span> = hash
    <span class="hljs-constant">authorityKeyIdentifier</span> = keyid,issuer:always
    <span class="hljs-constant">keyUsage</span> = critical, digitalSignature, keyEncipherment
    <span class="hljs-constant">extendedKeyUsage</span> = serverAuth</code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li><li style="color: rgb(153, 153, 153);">6</li><li style="color: rgb(153, 153, 153);">7</li><li style="color: rgb(153, 153, 153);">8</li><li style="color: rgb(153, 153, 153);">9</li></ul></pre>
    
    <p>The crl_ext extension is automatically applied when creating certificate revocation lists.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs vala has-numbering">[ crl_ext ]
    <span class="hljs-preprocessor"># Extension for CRLs (`man x509v3_config`).</span>
    authorityKeyIdentifier=keyid:always</code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li></ul></pre>
    
    <p>We’ll apply the ocsp extension when signing the Online Certificate Status Protocol (OCSP) certificate.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs makefile has-numbering">[ ocsp ]
    <span class="hljs-comment"># Extension for OCSP signing certificates (`man ocsp`).</span>
    <span class="hljs-constant">basicConstraints</span> = CA:FALSE
    <span class="hljs-constant">subjectKeyIdentifier</span> = hash
    <span class="hljs-constant">authorityKeyIdentifier</span> = keyid,issuer
    <span class="hljs-constant">keyUsage</span> = critical, digitalSignature
    <span class="hljs-constant">extendedKeyUsage</span> = critical, OCSPSigning</code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li><li style="color: rgb(153, 153, 153);">6</li><li style="color: rgb(153, 153, 153);">7</li></ul></pre>
    
    
    
    <h3 id="6-2-3-create-the-root-key"><a name="t24"></a>6-2-3) Create the root key</h3>
    
    <p>Create the root key (ca.key.pem) and keep it absolutely secure. Anyone in possession of the root key can issue trusted certificates. Encrypt the root key with AES 256-bit encryption and a strong password.</p>
    
    <blockquote>
      <p>Note:</p>
      
      <p>Use 4096 bits for all root and intermediate certificate authority keys. You’ll still be able to sign server and client certificates of a shorter length.</p>
    </blockquote>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs avrasm has-numbering">cd /root/ca
    openssl genrsa -aes256 -<span class="hljs-keyword">out</span> private/ca<span class="hljs-preprocessor">.key</span><span class="hljs-preprocessor">.pem</span> <span class="hljs-number">4096</span>
    
    Enter pass phrase for ca<span class="hljs-preprocessor">.key</span><span class="hljs-preprocessor">.pem</span>: secretpassword
    Verifying - Enter pass phrase for ca<span class="hljs-preprocessor">.key</span><span class="hljs-preprocessor">.pem</span>: secretpassword
    
    chmod <span class="hljs-number">400</span> private/ca<span class="hljs-preprocessor">.key</span><span class="hljs-preprocessor">.pem</span></code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li><li style="color: rgb(153, 153, 153);">6</li><li style="color: rgb(153, 153, 153);">7</li></ul></pre>
    
    
    
    <h3 id="6-2-4-create-the-root-certificate"><a name="t25"></a>6-2-4) Create the root certificate</h3>
    
    <p>Use the root key (ca.key.pem) to create a root certificate (ca.cert.pem). Give the root certificate a long expire date, such as twenty years. Once the root certificate expires, all certificates signed by the CA become invalid.</p>
    
    <blockquote>
      <p>Warning</p>
      
      <p>Whenever you use the req tool, you must specifiy a configuration file to use with the -config option, otherwise OpenSSL will default to /etc/pki/tls/openssl.cnf</p>
    </blockquote>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs lasso has-numbering">cd /root/ca
    openssl req <span class="hljs-attribute">-config</span> openssl<span class="hljs-built_in">.</span>cnf <span class="hljs-subst">\</span>
        <span class="hljs-attribute">-key</span> <span class="hljs-keyword">private</span>/ca<span class="hljs-built_in">.</span>key<span class="hljs-built_in">.</span>pem <span class="hljs-subst">\</span>
        <span class="hljs-attribute">-new</span> <span class="hljs-attribute">-x509</span> <span class="hljs-attribute">-days</span> <span class="hljs-number">7300</span> <span class="hljs-attribute">-sha256</span> <span class="hljs-attribute">-extensions</span> v3_ca <span class="hljs-subst">\</span>
        <span class="hljs-attribute">-out</span> certs/ca<span class="hljs-built_in">.</span>cert<span class="hljs-built_in">.</span>pem
    
    Enter pass phrase for ca<span class="hljs-built_in">.</span>key<span class="hljs-built_in">.</span>pem: secretpassword
    You are about <span class="hljs-keyword">to</span> be asked <span class="hljs-keyword">to</span> enter information that will be incorporated
    <span class="hljs-keyword">into</span> your certificate request<span class="hljs-built_in">.</span>
    <span class="hljs-subst">-----</span>
    Country Name (<span class="hljs-number">2</span> letter code) <span class="hljs-preprocessor">[</span>XX<span class="hljs-preprocessor">]</span><span class="hljs-markup">:GB
    State or Province Name </span><span class="hljs-preprocessor">[</span><span class="hljs-preprocessor">]</span><span class="hljs-markup">:England
    Locality Name </span><span class="hljs-preprocessor">[</span><span class="hljs-preprocessor">]</span><span class="hljs-markup">:
    Organization Name </span><span class="hljs-preprocessor">[</span><span class="hljs-preprocessor">]</span><span class="hljs-markup">:Alice Ltd
    Organizational Unit Name </span><span class="hljs-preprocessor">[</span><span class="hljs-preprocessor">]</span><span class="hljs-markup">:Alice Ltd Certificate Authority
    Common Name </span><span class="hljs-preprocessor">[</span><span class="hljs-preprocessor">]</span><span class="hljs-markup">:Alice Ltd Root CA
    Email Address </span><span class="hljs-preprocessor">[</span><span class="hljs-preprocessor">]</span><span class="hljs-markup">:</span></code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li><li style="color: rgb(153, 153, 153);">6</li><li style="color: rgb(153, 153, 153);">7</li><li style="color: rgb(153, 153, 153);">8</li><li style="color: rgb(153, 153, 153);">9</li><li style="color: rgb(153, 153, 153);">10</li><li style="color: rgb(153, 153, 153);">11</li><li style="color: rgb(153, 153, 153);">12</li><li style="color: rgb(153, 153, 153);">13</li><li style="color: rgb(153, 153, 153);">14</li><li style="color: rgb(153, 153, 153);">15</li><li style="color: rgb(153, 153, 153);">16</li><li style="color: rgb(153, 153, 153);">17</li></ul></pre>
    
    
    
    <h3 id="6-2-5-verify-the-root-certificate"><a name="t26"></a>6-2-5) Verify the root certificate</h3>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs avrasm has-numbering">openssl x509 -noout -text -<span class="hljs-keyword">in</span> certs/ca<span class="hljs-preprocessor">.cert</span><span class="hljs-preprocessor">.pem</span></code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li></ul></pre>
    
    <p>The output shows:</p>
    
    <ul>
    <li>the signature algorithm used</li>
    <li>the dates of certificate validit</li>
    <li>the public-key bit length</li>
    <li>the issuer, which is the entity that signed the certificate</li>
    <li>the subject, which refers to the certificate itself</li>
    </ul>
    
    <p>The Issuer and Subject are identical as the certificate is self-signed. Note that all root certificates are self-signed.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs mathematica has-numbering"><span class="hljs-keyword">Signature</span> Algorithm: sha256WithRSAEncryption
        Issuer: <span class="hljs-keyword">C</span>=GB, ST=England,
                <span class="hljs-keyword">O</span>=Alice Ltd, OU=Alice Ltd Certificate Authority,
                CN=Alice Ltd <span class="hljs-keyword">Root</span> CA
        Validity
            <span class="hljs-keyword">Not</span> <span class="hljs-keyword">Before</span>: Apr <span class="hljs-number">11</span> <span class="hljs-number">12</span>:<span class="hljs-number">22</span>:<span class="hljs-number">58</span> <span class="hljs-number">2015</span> GMT
            <span class="hljs-keyword">Not</span> <span class="hljs-keyword">After</span> : Apr  <span class="hljs-number">6</span> <span class="hljs-number">12</span>:<span class="hljs-number">22</span>:<span class="hljs-number">58</span> <span class="hljs-number">2035</span> GMT
        Subject: <span class="hljs-keyword">C</span>=GB, ST=England,
                 <span class="hljs-keyword">O</span>=Alice Ltd, OU=Alice Ltd Certificate Authority,
                 CN=Alice Ltd <span class="hljs-keyword">Root</span> CA
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
                Public-Key: (<span class="hljs-number">4096</span> bit)</code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li><li style="color: rgb(153, 153, 153);">6</li><li style="color: rgb(153, 153, 153);">7</li><li style="color: rgb(153, 153, 153);">8</li><li style="color: rgb(153, 153, 153);">9</li><li style="color: rgb(153, 153, 153);">10</li><li style="color: rgb(153, 153, 153);">11</li><li style="color: rgb(153, 153, 153);">12</li><li style="color: rgb(153, 153, 153);">13</li></ul></pre>
    
    <p>The Output also shows the X509v3 extensions. We applied the v3_ca extension, so the options from [ v3_ca ] should be reflectted in the output.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs css has-numbering"><span class="hljs-tag">X509v3</span> <span class="hljs-tag">extensions</span>:
        <span class="hljs-tag">X509v3</span> <span class="hljs-tag">Subject</span> <span class="hljs-tag">Key</span> <span class="hljs-tag">Identifier</span>:
            38<span class="hljs-pseudo">:58</span><span class="hljs-pseudo">:29</span><span class="hljs-pseudo">:2F</span><span class="hljs-pseudo">:6B</span><span class="hljs-pseudo">:57</span><span class="hljs-pseudo">:79</span><span class="hljs-pseudo">:4F</span><span class="hljs-pseudo">:39</span><span class="hljs-pseudo">:FD</span><span class="hljs-pseudo">:32</span><span class="hljs-pseudo">:35</span><span class="hljs-pseudo">:60</span><span class="hljs-pseudo">:74</span><span class="hljs-pseudo">:92</span><span class="hljs-pseudo">:60</span><span class="hljs-pseudo">:6E</span><span class="hljs-pseudo">:E8</span><span class="hljs-pseudo">:2A</span><span class="hljs-pseudo">:31</span>
        <span class="hljs-tag">X509v3</span> <span class="hljs-tag">Authority</span> <span class="hljs-tag">Key</span> <span class="hljs-tag">Identifier</span>:
            <span class="hljs-tag">keyid</span><span class="hljs-pseudo">:38</span><span class="hljs-pseudo">:58</span><span class="hljs-pseudo">:29</span><span class="hljs-pseudo">:2F</span><span class="hljs-pseudo">:6B</span><span class="hljs-pseudo">:57</span><span class="hljs-pseudo">:79</span><span class="hljs-pseudo">:4F</span><span class="hljs-pseudo">:39</span><span class="hljs-pseudo">:FD</span><span class="hljs-pseudo">:32</span><span class="hljs-pseudo">:35</span><span class="hljs-pseudo">:60</span><span class="hljs-pseudo">:74</span><span class="hljs-pseudo">:92</span><span class="hljs-pseudo">:60</span><span class="hljs-pseudo">:6E</span><span class="hljs-pseudo">:E8</span><span class="hljs-pseudo">:2A</span><span class="hljs-pseudo">:31</span>
    
        <span class="hljs-tag">X509v3</span> <span class="hljs-tag">Basic</span> <span class="hljs-tag">Constraints</span>: <span class="hljs-tag">critical</span>
            <span class="hljs-tag">CA</span><span class="hljs-pseudo">:TRUE</span>
        <span class="hljs-tag">X509v3</span> <span class="hljs-tag">Key</span> <span class="hljs-tag">Usage</span>: <span class="hljs-tag">critical</span>
            <span class="hljs-tag">Digital</span> <span class="hljs-tag">Signature</span>, <span class="hljs-tag">Certificate</span> <span class="hljs-tag">Sign</span>, <span class="hljs-tag">CRL</span> <span class="hljs-tag">Sign</span></code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li><li style="color: rgb(153, 153, 153);">6</li><li style="color: rgb(153, 153, 153);">7</li><li style="color: rgb(153, 153, 153);">8</li><li style="color: rgb(153, 153, 153);">9</li><li style="color: rgb(153, 153, 153);">10</li></ul></pre>
    
    
    
    <h2 id="6-3-create-the-intermediate-pair"><a name="t27"></a>6-3) Create the intermediate pair</h2>
    
    <p>An intermediate certificate autority (CA) is an entity that can sign certificates on behalf of the root CA. The root CA signs the intermediate certificate, forming a chain of trust</p>
    
    <p>The purpose of using an intermediate certificate primarily of security. The root key can be kept offline and used as infrequently as possible. If the intermediate key is compromised, the root CA can revoke the intermediate certificate and create a new intermediate cryptographic pair.</p>
    
    
    
    <h3 id="6-3-1-prepare-the-directory"><a name="t28"></a>6-3-1) Prepare the directory</h3>
    
    <p>The root CA files are kept in /root/ca. Choose a different directory (/root/ca/intermediate) to store the intermediate CA files.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs perl has-numbering"><span class="hljs-keyword">mkdir</span> /root/ca/intermediate</code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li></ul></pre>
    
    <p>Create the smae directory structure used for the root files. It’s convenient to also create a csr directory to hold certificate siging requests.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs php has-numbering">cd /root/ca/intermediate
    mkdir certs crl csr newcerts <span class="hljs-keyword">private</span>
    chmod <span class="hljs-number">700</span> <span class="hljs-keyword">private</span>
    touch index.txt
    <span class="hljs-keyword">echo</span> <span class="hljs-number">1000</span> &gt; serial</code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li></ul></pre>
    
    <p>Add a crlnumber file to the intermediate CA directory tree. crlnumber is used to keep track of certificate revocation lists.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs vala has-numbering"><span class="hljs-preprocessor"># echo 1000 &gt; /root/ca/intermediate/crlnumber</span></code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li></ul></pre>
    
    <p>Copy the intermediate CA configuration file from the Appendix to /root/ca/intermediate/openssl.cnf. Five options have been changed compared to the root CA configuration file:</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs ini has-numbering"><span class="hljs-title">[ CA_default ]</span>
    <span class="hljs-setting">dir             = <span class="hljs-value">/root/ca/intermediate</span></span>
    <span class="hljs-setting">private_key     = <span class="hljs-value">$dir/private/intermediate.key.pem</span></span>
    <span class="hljs-setting">certificate     = <span class="hljs-value">$dir/certs/intermediate.cert.pem</span></span>
    <span class="hljs-setting">crl             = <span class="hljs-value">$dir/crl/intermediate.crl.pem</span></span>
    <span class="hljs-setting">policy          = <span class="hljs-value">policy_loose</span></span></code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li><li style="color: rgb(153, 153, 153);">6</li></ul></pre>
    
    
    
    <h3 id="6-3-2-create-the-intermediate-key"><a name="t29"></a>6-3-2) Create the intermediate key</h3>
    
    <p>Create the intermediate key (intermediate.key.pem). Encrypt the intermediate key with AES 256-bit encryption and a strong password.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs avrasm has-numbering"><span class="hljs-preprocessor"># cd /root/ca</span>
    <span class="hljs-preprocessor"># openssl genrsa -aes256 \</span>
          -<span class="hljs-keyword">out</span> intermediate/private/intermediate<span class="hljs-preprocessor">.key</span><span class="hljs-preprocessor">.pem</span> <span class="hljs-number">4096</span>
    
    Enter pass phrase for intermediate<span class="hljs-preprocessor">.key</span><span class="hljs-preprocessor">.pem</span>: secretpassword
    Verifying - Enter pass phrase for intermediate<span class="hljs-preprocessor">.key</span><span class="hljs-preprocessor">.pem</span>: secretpassword
    
    <span class="hljs-preprocessor"># chmod 400 intermediate/private/intermediate.key.pem</span></code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li><li style="color: rgb(153, 153, 153);">6</li><li style="color: rgb(153, 153, 153);">7</li><li style="color: rgb(153, 153, 153);">8</li></ul></pre>
    
    
    
    <h3 id="6-3-3-create-the-intermediate-certificate"><a name="t30"></a>6-3-3) Create the intermediate certificate</h3>
    
    <p>Use the intermediate key to create a certificate signing request (CSR). The details should generally match the root CA. The Common Name, however, must be different.</p>
    
    <blockquote>
      <p>Warning</p>
      
      <p>Make sure you specify the intermediate CA configuration file (intermediate/openssl.cnf).</p>
    </blockquote>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs vbnet has-numbering"><span class="hljs-preprocessor"># cd /root/ca</span>
    <span class="hljs-preprocessor"># openssl req -config intermediate/openssl.cnf -new -sha256 \</span>
          -<span class="hljs-keyword">key</span> intermediate/<span class="hljs-keyword">private</span>/intermediate.<span class="hljs-keyword">key</span>.pem \
          -out intermediate/csr/intermediate.csr.pem
    
    Enter pass phrase <span class="hljs-keyword">for</span> intermediate.<span class="hljs-keyword">key</span>.pem: secretpassword
    You are about <span class="hljs-keyword">to</span> be asked <span class="hljs-keyword">to</span> enter information that will be incorporated
    <span class="hljs-keyword">into</span> your certificate request.
    -----
    Country Name (<span class="hljs-number">2</span> letter code) [XX]:GB
    State <span class="hljs-keyword">or</span> Province Name []:England
    Locality Name []:
    Organization Name []:Alice Ltd
    Organizational Unit Name []:Alice Ltd Certificate Authority
    Common Name []:Alice Ltd Intermediate CA
    Email Address []:</code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li><li style="color: rgb(153, 153, 153);">6</li><li style="color: rgb(153, 153, 153);">7</li><li style="color: rgb(153, 153, 153);">8</li><li style="color: rgb(153, 153, 153);">9</li><li style="color: rgb(153, 153, 153);">10</li><li style="color: rgb(153, 153, 153);">11</li><li style="color: rgb(153, 153, 153);">12</li><li style="color: rgb(153, 153, 153);">13</li><li style="color: rgb(153, 153, 153);">14</li><li style="color: rgb(153, 153, 153);">15</li><li style="color: rgb(153, 153, 153);">16</li></ul></pre>
    
    <p>To create an intermediate certificate, use the root CA with the v3_intermediate_ca extension to sign the intermediate CSR. The intermediate certificate should be valid for a shorter period than the root certificate. Ten years would be reasonable.</p>
    
    <blockquote>
      <p>Warning</p>
      
      <p>This time, specify the root CA configuration file (/root/ca/openssl.cnf).</p>
    </blockquote>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs perl has-numbering"><span class="hljs-comment"># cd /root/ca</span>
    <span class="hljs-comment"># openssl ca -config openssl.cnf -extensions v3_intermediate_ca \</span>
          -days <span class="hljs-number">3650</span> -notext -md sha256 \
          -in intermediate/csr/intermediate.csr.pem \
          -out intermediate/certs/intermediate.cert.pem
    
    Enter pass phrase <span class="hljs-keyword">for</span> ca.key.pem: secretpassword
    Sign the certificate? [<span class="hljs-regexp">y/n]: y
    
    # chmod 444 intermediate/certs/intermediate</span>.cert.pem</code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li><li style="color: rgb(153, 153, 153);">6</li><li style="color: rgb(153, 153, 153);">7</li><li style="color: rgb(153, 153, 153);">8</li><li style="color: rgb(153, 153, 153);">9</li><li style="color: rgb(153, 153, 153);">10</li></ul></pre>
    
    <p>The index.txt file is where the OpenSSL ca tool stores the certificate database. Do not delete or edit this file by hand. It should now contain a line that refers to the intermediate certificate.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs r has-numbering">V 250408122707Z <span class="hljs-number">1000</span> unknown <span class="hljs-keyword">...</span> /CN=Alice Ltd Intermediate CA</code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li></ul></pre>
    
    
    
    <h3 id="6-3-4-verify-the-intermediate-certificate"><a name="t31"></a>6-3-4) Verify the intermediate certificate</h3>
    
    <p>As we did for the root certificate, check that the details of the intermediate certificate are correct.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs avrasm has-numbering"><span class="hljs-preprocessor"># openssl x509 -noout -text \</span>
          -<span class="hljs-keyword">in</span> intermediate/certs/intermediate<span class="hljs-preprocessor">.cert</span><span class="hljs-preprocessor">.pem</span></code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li></ul></pre>
    
    <p>Verify the intermediate certificate against the root certificate. An OK indicates that the chain of trust is intact.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs avrasm has-numbering"><span class="hljs-preprocessor"># openssl verify -CAfile certs/ca.cert.pem \</span>
          intermediate/certs/intermediate<span class="hljs-preprocessor">.cert</span><span class="hljs-preprocessor">.pem</span>
    
    <span class="hljs-label">intermediate.cert.pem:</span> OK</code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li></ul></pre>
    
    
    
    <h3 id="6-3-5-create-the-certificate-chain-file"><a name="t32"></a>6-3-5) Create the certificate chain file</h3>
    
    <p>When an application (eg, a web browser) tries to verify a certificate signed by the intermediate CA, it must also verify the intermediate certificate against the root certificate. To complete the chain of trust, create a CA certificate chain to present to the application.</p>
    
    <p>To create the CA certificate chain, concatenate the intermediate and root certificates together. We will use this file later to verify certificates signed by the intermediate CA.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs avrasm has-numbering"><span class="hljs-preprocessor"># cat intermediate/certs/intermediate.cert.pem \</span>
          certs/ca<span class="hljs-preprocessor">.cert</span><span class="hljs-preprocessor">.pem</span> &gt; intermediate/certs/ca-chain<span class="hljs-preprocessor">.cert</span><span class="hljs-preprocessor">.pem</span>
    <span class="hljs-preprocessor"># chmod 444 intermediate/certs/ca-chain.cert.pem</span></code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li></ul></pre>
    
    <blockquote>
      <p>Note</p>
      
      <p>Our certificate chain file must include the root certificate because no client application knows about it yet. A better option, particularly if you’re administrating an intranet, is to install your root certificate on every client that needs to connect. In that case, the chain file need only contain your intermediate certificate.</p>
    </blockquote>
    
    
    
    <h2 id="6-4-sign-server-and-client-certificates"><a name="t33"></a>6-4) Sign server and client certificates</h2>
    
    <p>We will be signing certificates using our intermediate CA. You can use these signed certificates in a variety of situations, such as to secure connections to a web server or to authenticate clients connecting to a server.</p>
    
    <blockquote>
      <p>Note</p>
      
      <p>The steps below are from your perspective as the certificate authority. A third-party, however, can instead create their own private key and certificate signing request (CSR) without revealing their private key to you. They give you their CSR, and you give back a signed certificate. In that scenario, skip the genrsa and req commands.</p>
    </blockquote>
    
    
    
    <h3 id="6-4-1-create-a-key"><a name="t34"></a>6-4-1) Create a key</h3>
    
    <p>Our root and intermediate pairs are 4096 bits. Server and client certificates normally expire after one year, so we can safely use 2048 bits instead.</p>
    
    <blockquote>
      <p>Note</p>
      
      <p>Although 4096 bits is slightly more secure than 2048 bits, it slows down TLS handshakes and significantly increase processor load during handshakes. For this reason, most websites use 2048 bits pairs.</p>
    </blockquote>
    
    <p>If you’re creating a cryptograhic pair for use with a web server, you’ll need to enter this password every time you restart that web server. You may want to omit the -aes256 option to create a key without a password.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs avrasm has-numbering"><span class="hljs-preprocessor"># cd /root/ca</span>
    <span class="hljs-preprocessor"># openssl genrsa -aes256 \</span>
          -<span class="hljs-keyword">out</span> intermediate/private/www<span class="hljs-preprocessor">.example</span><span class="hljs-preprocessor">.com</span><span class="hljs-preprocessor">.key</span><span class="hljs-preprocessor">.pem</span> <span class="hljs-number">2048</span>
    <span class="hljs-preprocessor"># chmod 400 intermediate/private/www.example.com.key.pem</span></code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li></ul></pre>
    
    
    
    <h3 id="6-4-2-create-a-certificate"><a name="t35"></a>6-4-2) Create a certificate</h3>
    
    <p>Use the private key to create a certificate signing request (CSR). The CSR details don’t need to match the intermediate CA. For server certificates, the Common Name must be a fully quallfied domain name (eg, www.example.com) whereas for client certificates it can be any unique identifier (eg, an e-mail address). Note that the common name connot be the same as either your root or intermediate certifcate.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs avrasm has-numbering"><span class="hljs-preprocessor"># cd /root/ca</span>
    <span class="hljs-preprocessor"># openssl req -config intermediate/openssl.cnf \</span>
          -key intermediate/private/www<span class="hljs-preprocessor">.example</span><span class="hljs-preprocessor">.com</span><span class="hljs-preprocessor">.key</span><span class="hljs-preprocessor">.pem</span> \
          -new -sha256 -<span class="hljs-keyword">out</span> intermediate/csr/www<span class="hljs-preprocessor">.example</span><span class="hljs-preprocessor">.com</span><span class="hljs-preprocessor">.csr</span><span class="hljs-preprocessor">.pem</span>
    
    Enter pass phrase for www<span class="hljs-preprocessor">.example</span><span class="hljs-preprocessor">.com</span><span class="hljs-preprocessor">.key</span><span class="hljs-preprocessor">.pem</span>: secretpassword
    You are about to be asked to enter information that will be incorporated
    into your certificate request.
    -----
    Country Name (<span class="hljs-number">2</span> letter code) [XX]:US
    State <span class="hljs-keyword">or</span> Province Name []:California
    Locality Name []:Mountain View
    Organization Name []:Alice Ltd
    Organizational Unit Name []:Alice Ltd Web Services
    Common Name []:www<span class="hljs-preprocessor">.example</span><span class="hljs-preprocessor">.com</span>
    Email Address []:</code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li><li style="color: rgb(153, 153, 153);">6</li><li style="color: rgb(153, 153, 153);">7</li><li style="color: rgb(153, 153, 153);">8</li><li style="color: rgb(153, 153, 153);">9</li><li style="color: rgb(153, 153, 153);">10</li><li style="color: rgb(153, 153, 153);">11</li><li style="color: rgb(153, 153, 153);">12</li><li style="color: rgb(153, 153, 153);">13</li><li style="color: rgb(153, 153, 153);">14</li><li style="color: rgb(153, 153, 153);">15</li><li style="color: rgb(153, 153, 153);">16</li></ul></pre>
    
    <p>To create a certificate, use the intermediate CA to sign the CSR. If the certificate is going to be used on a server, use the server_cert extension. If the certificate is going to be used for user authentication, use the usr_cert extension. Certificates are usually given a validity of one year, though a CA will typically give a few days extra for convenience.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs avrasm has-numbering"><span class="hljs-preprocessor"># cd /root/ca</span>
    <span class="hljs-preprocessor"># openssl ca -config intermediate/openssl.cnf \</span>
          -extensions server_cert -days <span class="hljs-number">375</span> -notext -md sha256 \
          -<span class="hljs-keyword">in</span> intermediate/csr/www<span class="hljs-preprocessor">.example</span><span class="hljs-preprocessor">.com</span><span class="hljs-preprocessor">.csr</span><span class="hljs-preprocessor">.pem</span> \
          -<span class="hljs-keyword">out</span> intermediate/certs/www<span class="hljs-preprocessor">.example</span><span class="hljs-preprocessor">.com</span><span class="hljs-preprocessor">.cert</span><span class="hljs-preprocessor">.pem</span>
    <span class="hljs-preprocessor"># chmod 444 intermediate/certs/www.example.com.cert.pem</span></code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li><li style="color: rgb(153, 153, 153);">6</li></ul></pre>
    
    <p>The intermediate/index.txt file should contain a line referring to this new certificate.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs r has-numbering">V 160420124233Z <span class="hljs-number">1000</span> unknown <span class="hljs-keyword">...</span> /CN=www.example.com</code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li></ul></pre>
    
    
    
    <h3 id="6-4-3-verify-the-certificate"><a name="t36"></a>6-4-3) Verify the certificate</h3>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs avrasm has-numbering"><span class="hljs-preprocessor"># openssl x509 -noout -text \</span>
          -<span class="hljs-keyword">in</span> intermediate/certs/www<span class="hljs-preprocessor">.example</span><span class="hljs-preprocessor">.com</span><span class="hljs-preprocessor">.cert</span><span class="hljs-preprocessor">.pem</span></code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li></ul></pre>
    
    <p>The Issuer is the intermediate CA. The Subject refers to the certificate itself.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs mathematica has-numbering"><span class="hljs-keyword">Signature</span> Algorithm: sha256WithRSAEncryption
        Issuer: <span class="hljs-keyword">C</span>=GB, ST=England,
                <span class="hljs-keyword">O</span>=Alice Ltd, OU=Alice Ltd Certificate Authority,
                CN=Alice Ltd Intermediate CA
        Validity
            <span class="hljs-keyword">Not</span> <span class="hljs-keyword">Before</span>: Apr <span class="hljs-number">11</span> <span class="hljs-number">12</span>:<span class="hljs-number">42</span>:<span class="hljs-number">33</span> <span class="hljs-number">2015</span> GMT
            <span class="hljs-keyword">Not</span> <span class="hljs-keyword">After</span> : Apr <span class="hljs-number">20</span> <span class="hljs-number">12</span>:<span class="hljs-number">42</span>:<span class="hljs-number">33</span> <span class="hljs-number">2016</span> GMT
        Subject: <span class="hljs-keyword">C</span>=US, ST=California, L=Mountain View,
                 <span class="hljs-keyword">O</span>=Alice Ltd, OU=Alice Ltd Web Services,
                 CN=www.example.com
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
                Public-Key: (<span class="hljs-number">2048</span> bit)</code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li><li style="color: rgb(153, 153, 153);">6</li><li style="color: rgb(153, 153, 153);">7</li><li style="color: rgb(153, 153, 153);">8</li><li style="color: rgb(153, 153, 153);">9</li><li style="color: rgb(153, 153, 153);">10</li><li style="color: rgb(153, 153, 153);">11</li><li style="color: rgb(153, 153, 153);">12</li><li style="color: rgb(153, 153, 153);">13</li></ul></pre>
    
    <p>The output will also show the X509v3 extensions. When creating the certificate, you used either the server_cert or usr_cert extension. The options from the corresponding configuration section will be reflected in the output.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs ruby has-numbering"><span class="hljs-constant">X509v3</span> <span class="hljs-symbol">extensions:</span>
        <span class="hljs-constant">X509v3</span> <span class="hljs-constant">Basic</span> <span class="hljs-constant">Constraints</span><span class="hljs-symbol">:</span>
            <span class="hljs-constant">CA</span><span class="hljs-symbol">:FALSE</span>
        <span class="hljs-constant">Netscape</span> <span class="hljs-constant">Cert</span> <span class="hljs-constant">Type</span><span class="hljs-symbol">:</span>
            <span class="hljs-constant">SSL</span> <span class="hljs-constant">Server</span>
        <span class="hljs-constant">Netscape</span> <span class="hljs-constant">Comment</span><span class="hljs-symbol">:</span>
            <span class="hljs-constant">OpenSSL</span> <span class="hljs-constant">Generated</span> <span class="hljs-constant">Server</span> <span class="hljs-constant">Certificate</span>
        <span class="hljs-constant">X509v3</span> <span class="hljs-constant">Subject</span> <span class="hljs-constant">Key</span> <span class="hljs-constant">Identifier</span><span class="hljs-symbol">:</span>
            <span class="hljs-constant">B1</span><span class="hljs-symbol">:B8</span><span class="hljs-symbol">:</span><span class="hljs-number">88</span><span class="hljs-symbol">:</span><span class="hljs-number">48</span><span class="hljs-symbol">:</span><span class="hljs-number">64</span><span class="hljs-symbol">:B7</span><span class="hljs-symbol">:</span><span class="hljs-number">45</span><span class="hljs-symbol">:</span><span class="hljs-number">52</span><span class="hljs-symbol">:</span><span class="hljs-number">21</span><span class="hljs-symbol">:CC</span><span class="hljs-symbol">:</span><span class="hljs-number">35</span><span class="hljs-symbol">:</span><span class="hljs-number">37</span><span class="hljs-symbol">:</span><span class="hljs-number">9</span><span class="hljs-constant">E:</span><span class="hljs-number">24</span><span class="hljs-symbol">:</span><span class="hljs-number">50</span><span class="hljs-symbol">:EE</span><span class="hljs-symbol">:AD</span><span class="hljs-symbol">:</span><span class="hljs-number">58</span><span class="hljs-symbol">:</span><span class="hljs-number">02</span><span class="hljs-symbol">:B5</span>
        <span class="hljs-constant">X509v3</span> <span class="hljs-constant">Authority</span> <span class="hljs-constant">Key</span> <span class="hljs-constant">Identifier</span><span class="hljs-symbol">:</span>
            <span class="hljs-symbol">keyid:</span><span class="hljs-number">69</span><span class="hljs-symbol">:E8</span><span class="hljs-symbol">:EC</span><span class="hljs-symbol">:</span><span class="hljs-number">54</span><span class="hljs-symbol">:</span><span class="hljs-number">7</span><span class="hljs-constant">F:</span><span class="hljs-number">25</span><span class="hljs-symbol">:</span><span class="hljs-number">23</span><span class="hljs-symbol">:</span><span class="hljs-number">60</span><span class="hljs-symbol">:E5</span><span class="hljs-symbol">:B6</span><span class="hljs-symbol">:E7</span><span class="hljs-symbol">:</span><span class="hljs-number">72</span><span class="hljs-symbol">:</span><span class="hljs-number">61</span><span class="hljs-symbol">:F1</span><span class="hljs-symbol">:D4</span><span class="hljs-symbol">:B9</span><span class="hljs-symbol">:</span><span class="hljs-number">21</span><span class="hljs-symbol">:D4</span><span class="hljs-symbol">:</span><span class="hljs-number">45</span><span class="hljs-symbol">:E9</span>
            <span class="hljs-constant">DirName</span><span class="hljs-symbol">:/C=GB/ST=England/O=Alice</span> <span class="hljs-constant">Ltd</span>/<span class="hljs-constant">OU</span>=<span class="hljs-constant">Alice</span> <span class="hljs-constant">Ltd</span> <span class="hljs-constant">Certificate</span> <span class="hljs-constant">Authority</span>/<span class="hljs-constant">CN</span>=<span class="hljs-constant">Alice</span> <span class="hljs-constant">Ltd</span> <span class="hljs-constant">Root</span> <span class="hljs-constant">CA</span>
            <span class="hljs-symbol">serial:</span><span class="hljs-number">10</span><span class="hljs-symbol">:</span><span class="hljs-number">00</span>
    
        <span class="hljs-constant">X509v3</span> <span class="hljs-constant">Key</span> <span class="hljs-constant">Usage</span><span class="hljs-symbol">:</span> critical
            <span class="hljs-constant">Digital</span> <span class="hljs-constant">Signature</span>, <span class="hljs-constant">Key</span> <span class="hljs-constant">Encipherment</span>
        <span class="hljs-constant">X509v3</span> <span class="hljs-constant">Extended</span> <span class="hljs-constant">Key</span> <span class="hljs-constant">Usage</span><span class="hljs-symbol">:</span>
            <span class="hljs-constant">TLS</span> <span class="hljs-constant">Web</span> <span class="hljs-constant">Server</span> <span class="hljs-constant">Authentication</span></code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li><li style="color: rgb(153, 153, 153);">6</li><li style="color: rgb(153, 153, 153);">7</li><li style="color: rgb(153, 153, 153);">8</li><li style="color: rgb(153, 153, 153);">9</li><li style="color: rgb(153, 153, 153);">10</li><li style="color: rgb(153, 153, 153);">11</li><li style="color: rgb(153, 153, 153);">12</li><li style="color: rgb(153, 153, 153);">13</li><li style="color: rgb(153, 153, 153);">14</li><li style="color: rgb(153, 153, 153);">15</li><li style="color: rgb(153, 153, 153);">16</li><li style="color: rgb(153, 153, 153);">17</li><li style="color: rgb(153, 153, 153);">18</li></ul></pre>
    
    <p>Use the CA certificate chain file we created earlier (ca-chain.cert.pem) to verfiy that the new certificate has a valid chain of trust.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs avrasm has-numbering"><span class="hljs-preprocessor"># openssl verify -CAfile intermediate/certs/ca-chain.cert.pem \</span>
          intermediate/certs/www<span class="hljs-preprocessor">.example</span><span class="hljs-preprocessor">.com</span><span class="hljs-preprocessor">.cert</span><span class="hljs-preprocessor">.pem</span>
    
    <span class="hljs-label">www.example.com.cert.pem:</span> OK</code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li></ul></pre>
    
    
    
    <h3 id="6-4-4-deploy-the-certificate"><a name="t37"></a>6-4-4) Deploy the certificate</h3>
    
    <p>You can now either deploy your new certificate to a server, or distribute the certificate to a client. When deploying to a server application (eg, Apache), you need to make the following files available:</p>
    
    <ul>
    <li>ca-chain.cert.com</li>
    <li>www.example.com.key.pem</li>
    <li>www.example.com.cert.pem</li>
    </ul>
    
    <p>If you’re signing a CSR from a third-party, you don’t have to access their private key so you only need to give them back the chain file (ca-chain.cert.pem) and the certificate (www.example.com.cert.pem).</p>
    
    
    
    <h2 id="6-5-certificate-revocation-lists"><a name="t38"></a>6-5) Certificate Revocation Lists</h2>
    
    <p>A certifciate revocation list (CRL) provides a list of certificates that have been revoked. A client application, such as a web browser, can use a CRL to check a server’s authenticity. A server application, such as Apache or OpenVPN, can use a CRL to deny access to clients that are no longer trusted.</p>
    
    <p>Publish the CRL at a public accessible location (eg, <a href="http://example.com/intermediate.crl.pem" rel="nofollow" target="_blank">http://example.com/intermediate.crl.pem</a>). Third-parties can fetch the CRL from this location to check wheter any certificates they rely on have been revoked.</p>
    
    <blockquote>
      <p>Note</p>
      
      <p>Some application vendors have deprecated CRLs and are instead using the Online Certificate Status Protocol (OCSP)</p>
    </blockquote>
    
    
    
    <h3 id="6-5-1-prepare-the-configuration-file"><a name="t39"></a>6-5-1) Prepare the configuration file</h3>
    
    <p>When a certificate authority signs a certificate, it will normally encode the CRL location into the certificate. Add crlDistributionPoints to the appropriate sections. In our case, add it to the [ server_cert ] section.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs ruby has-numbering">[ server_cert ]
    <span class="hljs-comment"># ... snipped ...</span>
    crlDistributionPoints = <span class="hljs-constant">URI</span><span class="hljs-symbol">:http</span><span class="hljs-symbol">://example</span>.com/intermediate.crl.pem</code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li></ul></pre>
    
    
    
    <h3 id="6-5-2-create-the-crl"><a name="t40"></a>6-5-2) Create the CRL</h3>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs avrasm has-numbering"><span class="hljs-preprocessor"># cd /root/ca</span>
    <span class="hljs-preprocessor"># openssl ca -config intermediate/openssl.cnf \</span>
          -gencrl -<span class="hljs-keyword">out</span> intermediate/crl/intermediate<span class="hljs-preprocessor">.crl</span><span class="hljs-preprocessor">.pem</span></code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li></ul></pre>
    
    <blockquote>
      <p>Note</p>
      
      <p>The CRL OPTIONS section of the ca man page contains more information on how to create CRLs.</p>
    </blockquote>
    
    <p>You can check the contents of the CRL with the crl tool.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs avrasm has-numbering">openssl crl -<span class="hljs-keyword">in</span> intermediate/crl/intermediate<span class="hljs-preprocessor">.crl</span><span class="hljs-preprocessor">.pem</span> -noout -text</code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li></ul></pre>
    
    <p>No certificates have been revoked yet, so the output will state <code>No Revoked Certificates</code></p>
    
    <p>You should re-create the CRLs at regular intervals. By default, the CRL expire after 30 days. This is controlled by the <code>default_crl_days</code> option in the <code>[ CA_default ]</code> section.</p>
    
    
    
    <h3 id="6-5-3-revoke-a-certificate"><a name="t41"></a>6-5-3) Revoke a certificate</h3>
    
    <p>Let’s walk through an example. Alice is running the Apache server and has a private folder of heart-meltingly cute kitten pictures. Alice wants to grant her friend, bob, access to this collection.</p>
    
    <p>Bob create a private key and certificate signing request (CSR).</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs avrasm has-numbering">cd /home/bob
    openssl genrsa -<span class="hljs-keyword">out</span> bob@example<span class="hljs-preprocessor">.com</span><span class="hljs-preprocessor">.key</span><span class="hljs-preprocessor">.pem</span> <span class="hljs-number">2048</span>
    openssl req -new -key bob@example<span class="hljs-preprocessor">.com</span><span class="hljs-preprocessor">.key</span><span class="hljs-preprocessor">.pem</span> \
        -<span class="hljs-keyword">out</span> bob@example<span class="hljs-preprocessor">.com</span><span class="hljs-preprocessor">.csr</span><span class="hljs-preprocessor">.pem</span>
    
    You are about to be asked to enter information that will be incorporated
    into your certificate request.
    -----
    Country Name [XX]:US
    State <span class="hljs-keyword">or</span> Province Name []:California
    Locality Name []:San Francisco
    Organization Name []:Bob Ltd
    Organizational Unit Name []:
    Common Name []:bob@example<span class="hljs-preprocessor">.com</span>
    Email Address []:</code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li><li style="color: rgb(153, 153, 153);">6</li><li style="color: rgb(153, 153, 153);">7</li><li style="color: rgb(153, 153, 153);">8</li><li style="color: rgb(153, 153, 153);">9</li><li style="color: rgb(153, 153, 153);">10</li><li style="color: rgb(153, 153, 153);">11</li><li style="color: rgb(153, 153, 153);">12</li><li style="color: rgb(153, 153, 153);">13</li><li style="color: rgb(153, 153, 153);">14</li><li style="color: rgb(153, 153, 153);">15</li></ul></pre>
    
    <p>Bob sends his CSR to Alice, who then signs it.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs avrasm has-numbering">cd /root/ca
    openssl ca -config intermediate/openssl<span class="hljs-preprocessor">.cnf</span> \
        -extension usr_cert -notext -md sha256 \
        -<span class="hljs-keyword">in</span> intermediate/csr/bob@example<span class="hljs-preprocessor">.com</span><span class="hljs-preprocessor">.csr</span><span class="hljs-preprocessor">.pem</span> \
        -<span class="hljs-keyword">out</span> intermediate/certs/bob@example<span class="hljs-preprocessor">.com</span><span class="hljs-preprocessor">.cert</span><span class="hljs-preprocessor">.pem</span></code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li></ul></pre>
    
    <p>Alice verifies that the certificate is valid:</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs avrasm has-numbering">openssl verify -CAfile intermediate/certs/ca-chain<span class="hljs-preprocessor">.cert</span><span class="hljs-preprocessor">.pem</span> \
        intermediate/certs/bob@example<span class="hljs-preprocessor">.com</span><span class="hljs-preprocessor">.cert</span><span class="hljs-preprocessor">.pem</span>
    
    bob@example<span class="hljs-preprocessor">.com</span><span class="hljs-preprocessor">.cert</span><span class="hljs-preprocessor">.pem</span>: OK</code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li></ul></pre>
    
    <p>The index.txt file should contain a new entry</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs r has-numbering">V 160420124740Z <span class="hljs-number">1001</span> unknown <span class="hljs-keyword">...</span> /CN=bob@example.com</code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li></ul></pre>
    
    <p>Alice sends Bob teh signed certificate. Bob installs the certificate in his web brower and is now able to access Alice’s kitten pictures. Hurray!</p>
    
    <p>Sadly, it turns out that Bob is misbehaving. Bob has posted Alice’s kitten pictures to Hacker News, claiming that they’re his own and gaining huge popularity. Alice finds out and needs to revoke his access immediately.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs avrasm has-numbering">cd /root/ca
    openssl ca -config intermediate/openssl<span class="hljs-preprocessor">.cnf</span> \
        -revoke intermediate/certs/bob@example<span class="hljs-preprocessor">.com</span><span class="hljs-preprocessor">.cert</span><span class="hljs-preprocessor">.pem</span>
    
    
    Enter pass phrase for intermediate<span class="hljs-preprocessor">.key</span><span class="hljs-preprocessor">.pem</span>: secretpassword
    Revoking Certificate <span class="hljs-number">1001.</span>
    Data Base Updated</code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li><li style="color: rgb(153, 153, 153);">6</li><li style="color: rgb(153, 153, 153);">7</li><li style="color: rgb(153, 153, 153);">8</li></ul></pre>
    
    <p>The line in index.txt that corresponds to Bob’s certificate now begins with the character R, This means the certificate has been revoked.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs r has-numbering">R 160420124740Z 150411125310Z <span class="hljs-number">1001</span> unknown <span class="hljs-keyword">...</span> /CN=bob@example.com</code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li></ul></pre>
    
    <p>After revoking Bob’s certificate, Alice must re-create the CRL.</p>
    
    
    
    <h3 id="6-5-4-server-side-use-of-the-crl"><a name="t42"></a>6-5-4) Server-side use of the CRL</h3>
    
    <p>For client certificates, It’s typically a server-side application (eg, Apache) that doing the verification. This application need to have local access to the CRL.</p>
    
    <p>In Alice’s case, she can add the <code>SSLCARevocationPath</code> directive to her Apache configuration and copy the CRL to her web server. The next time that Bob connects to the web server, Apache will check his client certificate against the CRL and deny access.</p>
    
    <p>Similarly, OpenVPN has a <code>crl-verfiy</code> directive so that it can block clients that have had their certificates revoked.</p>
    
    
    
    <h3 id="6-5-5-client-side-use-of-the-crl"><a name="t43"></a>6-5-5) Client-side use of the CRL</h3>
    
    <p>For server certificate, it’s typically a server-side application (eg, a web browser) that doing the verification. This application must have remove access to the CRL.</p>
    
    <p>If a certificate was signed with an extension that include <code>crlDistributionPoints</code>, a client-side application can read this information and fetch the CRL from teh specified location.</p>
    
    <p>The CRL distribution Point is visible in the certificate X509v3 details.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs avrasm has-numbering">opnessl x509 -<span class="hljs-keyword">in</span> cute-kitten-pictures<span class="hljs-preprocessor">.example</span><span class="hljs-preprocessor">.com</span><span class="hljs-preprocessor">.cert</span><span class="hljs-preprocessor">.pem</span> -noout -text
    
    X509v3 CRL Distribution Points:
    
            Full Name:
              URI:http://example<span class="hljs-preprocessor">.com</span>/intermediate<span class="hljs-preprocessor">.crl</span><span class="hljs-preprocessor">.pem</span></code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li><li style="color: rgb(153, 153, 153);">6</li></ul></pre>
    
    
    
    <h2 id="6-6-online-certificate-status-protocol"><a name="t44"></a>6-6) Online Certificate Status Protocol</h2>
    
    <p>The Online Certificate Status Protocol (OCSP) was created as an alternative to certificate revocation lists (CRLs). Similar to CRLs, OCSP enable a requesting party (eg, a web browser) to determine the revocation state of a certificate.</p>
    
    <p>When a CA signs a certificate, they will typically include the OCSP server address in the certificate. This is similar in function to <code>crlDistributionPoints</code> used for CRLs.</p>
    
    <p>As an example, when a web browser is presented with a server certificate, it will send a query to the OCSP server address sepcified in the certificate. at this address, an OCSP responder listens to queries and responds with the revocation status of the certificate.</p>
    
    <blockquote>
      <p>Note:</p>
      
      <p>It’s recommended to use OCSP instead where possible, though realistically you will tend to only need OCSP for website certficate. Some web browsers have deprecated or removed support for CRLs.</p>
    </blockquote>
    
    
    
    <h3 id="6-6-1-prepare-the-configuartion-file"><a name="t45"></a>6-6-1) Prepare the configuartion file</h3>
    
    <p>To use OCSP, CA must encode the OCSP server location into the certificates that it signs. Use the <code>authorityInfoAccess</code> option in the appropriate sections, which in out case means the <code>[ server_cert ]</code> section.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs ruby has-numbering">[ server_cert ]
    <span class="hljs-comment"># ... snipped ...</span>
    authorityInfoAccess = <span class="hljs-constant">OCSP</span>;<span class="hljs-constant">URI</span><span class="hljs-symbol">:http</span><span class="hljs-symbol">://ocsp</span>.example.com</code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li></ul></pre>
    
    
    
    <h3 id="6-6-2-create-the-ocsp-pair"><a name="t46"></a>6-6-2) Create the OCSP pair</h3>
    
    <p>The OCSP responder requires a cryptographic pair for signing the response that it sends to the requesting party. The OCSP cryptographic pair. The OCSP cryptographic pair must be signed by the same CA that signed the certificate being checked.</p>
    
    <p>Create a private key and encrypt it with AES-256 encryption.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs avrasm has-numbering"><span class="hljs-preprocessor"># cd /root/ca</span>
    <span class="hljs-preprocessor"># openssl genrsa -aes256 \</span>
          -<span class="hljs-keyword">out</span> intermediate/private/ocsp<span class="hljs-preprocessor">.example</span><span class="hljs-preprocessor">.com</span><span class="hljs-preprocessor">.key</span><span class="hljs-preprocessor">.pem</span> <span class="hljs-number">4096</span></code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li></ul></pre>
    
    <p>Create a certificate signing request (CSR). The details should generally match those of the signing CA. The Common Name, however, must be fully qualified domain name.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs avrasm has-numbering"><span class="hljs-preprocessor"># cd /root/ca</span>
    <span class="hljs-preprocessor"># openssl req -config intermediate/openssl.cnf -new -sha256 \</span>
          -key intermediate/private/ocsp<span class="hljs-preprocessor">.example</span><span class="hljs-preprocessor">.com</span><span class="hljs-preprocessor">.key</span><span class="hljs-preprocessor">.pem</span> \
          -<span class="hljs-keyword">out</span> intermediate/csr/ocsp<span class="hljs-preprocessor">.example</span><span class="hljs-preprocessor">.com</span><span class="hljs-preprocessor">.csr</span><span class="hljs-preprocessor">.pem</span>
    
    Enter pass phrase for intermediate<span class="hljs-preprocessor">.key</span><span class="hljs-preprocessor">.pem</span>: secretpassword
    You are about to be asked to enter information that will be incorporated
    into your certificate request.
    -----
    Country Name (<span class="hljs-number">2</span> letter code) [XX]:GB
    State <span class="hljs-keyword">or</span> Province Name []:England
    Locality Name []:
    Organization Name []:Alice Ltd
    Organizational Unit Name []:Alice Ltd Certificate Authority
    Common Name []:ocsp<span class="hljs-preprocessor">.example</span><span class="hljs-preprocessor">.com</span>
    Email Address []:
    </code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li><li style="color: rgb(153, 153, 153);">6</li><li style="color: rgb(153, 153, 153);">7</li><li style="color: rgb(153, 153, 153);">8</li><li style="color: rgb(153, 153, 153);">9</li><li style="color: rgb(153, 153, 153);">10</li><li style="color: rgb(153, 153, 153);">11</li><li style="color: rgb(153, 153, 153);">12</li><li style="color: rgb(153, 153, 153);">13</li><li style="color: rgb(153, 153, 153);">14</li><li style="color: rgb(153, 153, 153);">15</li><li style="color: rgb(153, 153, 153);">16</li><li style="color: rgb(153, 153, 153);">17</li></ul></pre>
    
    <p>Sign the CSR with the intermediate CA.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs avrasm has-numbering"><span class="hljs-preprocessor"># openssl ca -config intermediate/openssl.cnf \</span>
          -extensions ocsp -days <span class="hljs-number">375</span> -notext -md sha256 \
          -<span class="hljs-keyword">in</span> intermediate/csr/ocsp<span class="hljs-preprocessor">.example</span><span class="hljs-preprocessor">.com</span><span class="hljs-preprocessor">.csr</span><span class="hljs-preprocessor">.pem</span> \
          -<span class="hljs-keyword">out</span> intermediate/certs/ocsp<span class="hljs-preprocessor">.example</span><span class="hljs-preprocessor">.com</span><span class="hljs-preprocessor">.cert</span><span class="hljs-preprocessor">.pem</span></code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li></ul></pre>
    
    <p>Verify that the certificate has the correct X509v3 extensions.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs avrasm has-numbering"><span class="hljs-preprocessor"># openssl x509 -noout -text \</span>
          -<span class="hljs-keyword">in</span> intermediate/certs/ocsp<span class="hljs-preprocessor">.example</span><span class="hljs-preprocessor">.com</span><span class="hljs-preprocessor">.cert</span><span class="hljs-preprocessor">.pem</span>
    
        X509v3 Key Usage: critical
            Digital Signature
        X509v3 Extended Key Usage: critical
            OCSP Signing</code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li><li style="color: rgb(153, 153, 153);">6</li><li style="color: rgb(153, 153, 153);">7</li></ul></pre>
    
    
    
    <h3 id="6-6-3-revoke-a-certificate"><a name="t47"></a>6-6-3) Revoke a certificate</h3>
    
    <p>The OpenSSL ocsp tool can act as an OCSP responder, but it’s only intended for testing. Production ready OCSP responders exist, but those are beyond the scope of this guide.</p>
    
    <p>Create a server certificate to test.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs avrasm has-numbering"><span class="hljs-preprocessor"># cd /root/ca</span>
    <span class="hljs-preprocessor"># openssl genrsa -out intermediate/private/test.example.com.key.pem 2048</span>
    <span class="hljs-preprocessor"># openssl req -config intermediate/openssl.cnf \</span>
          -key intermediate/private/test<span class="hljs-preprocessor">.example</span><span class="hljs-preprocessor">.com</span><span class="hljs-preprocessor">.key</span><span class="hljs-preprocessor">.pem</span> \
          -new -sha256 -<span class="hljs-keyword">out</span> intermediate/csr/test<span class="hljs-preprocessor">.example</span><span class="hljs-preprocessor">.com</span><span class="hljs-preprocessor">.csr</span><span class="hljs-preprocessor">.pem</span>
    <span class="hljs-preprocessor"># openssl ca -config intermediate/openssl.cnf \</span>
          -extensions server_cert -days <span class="hljs-number">375</span> -notext -md sha256 \
          -<span class="hljs-keyword">in</span> intermediate/csr/test<span class="hljs-preprocessor">.example</span><span class="hljs-preprocessor">.com</span><span class="hljs-preprocessor">.csr</span><span class="hljs-preprocessor">.pem</span> \
          -<span class="hljs-keyword">out</span> intermediate/certs/test<span class="hljs-preprocessor">.example</span><span class="hljs-preprocessor">.com</span><span class="hljs-preprocessor">.cert</span><span class="hljs-preprocessor">.pem</span></code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li><li style="color: rgb(153, 153, 153);">6</li><li style="color: rgb(153, 153, 153);">7</li><li style="color: rgb(153, 153, 153);">8</li><li style="color: rgb(153, 153, 153);">9</li></ul></pre>
    
    <p>Run the OCSP responder on localhost. Rather than storing revocation status in a separate CRL file, the OCSP responder reads index.txt directly. The response is signed with the OCSP cryptographic pair (using the -rkey and -rsigner options).</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs avrasm has-numbering">openssl ocsp -port <span class="hljs-number">127.0</span><span class="hljs-number">.0</span><span class="hljs-number">.1</span>:<span class="hljs-number">2560</span> -text -sha256 \
          -index intermediate/index<span class="hljs-preprocessor">.txt</span> \
          -CA intermediate/certs/ca-chain<span class="hljs-preprocessor">.cert</span><span class="hljs-preprocessor">.pem</span> \
          -rkey intermediate/private/ocsp<span class="hljs-preprocessor">.example</span><span class="hljs-preprocessor">.com</span><span class="hljs-preprocessor">.key</span><span class="hljs-preprocessor">.pem</span> \
          -rsigner intermediate/certs/ocsp<span class="hljs-preprocessor">.example</span><span class="hljs-preprocessor">.com</span><span class="hljs-preprocessor">.cert</span><span class="hljs-preprocessor">.pem</span> \
          -nrequest <span class="hljs-number">1</span>
    </code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li><li style="color: rgb(153, 153, 153);">6</li><li style="color: rgb(153, 153, 153);">7</li></ul></pre>
    
    <p>In another terminal, send a query to the OCSP responder. The -cert option specifies the certificate to query.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs avrasm has-numbering"><span class="hljs-preprocessor"># openssl ocsp -CAfile intermediate/certs/ca-chain.cert.pem \</span>
          -url http://<span class="hljs-number">127.0</span><span class="hljs-number">.0</span><span class="hljs-number">.1</span>:<span class="hljs-number">2560</span> -resp_text \
          -issuer intermediate/certs/intermediate<span class="hljs-preprocessor">.cert</span><span class="hljs-preprocessor">.pem</span> \
          -cert intermediate/certs/test<span class="hljs-preprocessor">.example</span><span class="hljs-preprocessor">.com</span><span class="hljs-preprocessor">.cert</span><span class="hljs-preprocessor">.pem</span></code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li></ul></pre>
    
    <p>The start of the output shows:</p>
    
    <ul>
    <li>whether a successful response was received (OCSP Response Status)</li>
    <li>then identity of the responder (Responder Id)</li>
    <li>the revocation status of the certficate (Cert Status)</li>
    </ul>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs r has-numbering">OCSP Response Data:
        OCSP Response Status: successful (<span class="hljs-number">0x0</span>)
        Response Type: Basic OCSP Response
        Version: <span class="hljs-number">1</span> (<span class="hljs-number">0x0</span>)
        Responder Id: <span class="hljs-keyword">...</span> CN = ocsp.example.com
        Produced At: Apr <span class="hljs-number">11</span> <span class="hljs-number">12</span>:<span class="hljs-number">59</span>:<span class="hljs-number">51</span> <span class="hljs-number">2015</span> GMT
        Responses:
        Certificate ID:
          Hash Algorithm: sha1
          Issuer Name Hash: E35979B6D0A973EBE8AEDED75D8C27D67D2A0334
          Issuer Key Hash: 69E8EC547F252360E5B6E77261F1D4B921D445E9
          Serial Number: <span class="hljs-number">1003</span>
        Cert Status: good
        This Update: Apr <span class="hljs-number">11</span> <span class="hljs-number">12</span>:<span class="hljs-number">59</span>:<span class="hljs-number">51</span> <span class="hljs-number">2015</span> GMT</code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li><li style="color: rgb(153, 153, 153);">6</li><li style="color: rgb(153, 153, 153);">7</li><li style="color: rgb(153, 153, 153);">8</li><li style="color: rgb(153, 153, 153);">9</li><li style="color: rgb(153, 153, 153);">10</li><li style="color: rgb(153, 153, 153);">11</li><li style="color: rgb(153, 153, 153);">12</li><li style="color: rgb(153, 153, 153);">13</li><li style="color: rgb(153, 153, 153);">14</li></ul></pre>
    
    <p>Revoke the certificate.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs avrasm has-numbering"><span class="hljs-preprocessor"># openssl ca -config intermediate/openssl.cnf \</span>
          -revoke intermediate/certs/test<span class="hljs-preprocessor">.example</span><span class="hljs-preprocessor">.com</span><span class="hljs-preprocessor">.cert</span><span class="hljs-preprocessor">.pem</span>
    
    Enter pass phrase for intermediate<span class="hljs-preprocessor">.key</span><span class="hljs-preprocessor">.pem</span>: secretpassword
    Revoking Certificate <span class="hljs-number">1003.</span>
    Data Base Updated</code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li><li style="color: rgb(153, 153, 153);">6</li></ul></pre>
    
    <p>As before, run the OCSP responder and on another terminal send a query. This time, the output shows Cert Status: revoked and a Revocation Time.</p>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs r has-numbering">OCSP Response Data:
        OCSP Response Status: successful (<span class="hljs-number">0x0</span>)
        Response Type: Basic OCSP Response
        Version: <span class="hljs-number">1</span> (<span class="hljs-number">0x0</span>)
        Responder Id: <span class="hljs-keyword">...</span> CN = ocsp.example.com
        Produced At: Apr <span class="hljs-number">11</span> <span class="hljs-number">13</span>:<span class="hljs-number">03</span>:<span class="hljs-number">00</span> <span class="hljs-number">2015</span> GMT
        Responses:
        Certificate ID:
          Hash Algorithm: sha1
          Issuer Name Hash: E35979B6D0A973EBE8AEDED75D8C27D67D2A0334
          Issuer Key Hash: 69E8EC547F252360E5B6E77261F1D4B921D445E9
          Serial Number: <span class="hljs-number">1003</span>
        Cert Status: revoked
        Revocation Time: Apr <span class="hljs-number">11</span> <span class="hljs-number">13</span>:<span class="hljs-number">01</span>:<span class="hljs-number">09</span> <span class="hljs-number">2015</span> GMT
        This Update: Apr <span class="hljs-number">11</span> <span class="hljs-number">13</span>:<span class="hljs-number">03</span>:<span class="hljs-number">00</span> <span class="hljs-number">2015</span> GMT</code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li><li style="color: rgb(153, 153, 153);">6</li><li style="color: rgb(153, 153, 153);">7</li><li style="color: rgb(153, 153, 153);">8</li><li style="color: rgb(153, 153, 153);">9</li><li style="color: rgb(153, 153, 153);">10</li><li style="color: rgb(153, 153, 153);">11</li><li style="color: rgb(153, 153, 153);">12</li><li style="color: rgb(153, 153, 153);">13</li><li style="color: rgb(153, 153, 153);">14</li><li style="color: rgb(153, 153, 153);">15</li></ul></pre>
    
    
    
    <h2 id="6-7-appendix"><a name="t48"></a>6-7) Appendix</h2>
    
    
    
    <h3 id="6-7-1-root-ca-configuration-file"><a name="t49"></a>6-7-1) Root CA configuration file</h3>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs makefile has-numbering"><span class="hljs-comment"># OpenSSL root CA configuration file.</span>
    <span class="hljs-comment"># Copy to `/root/ca/openssl.cnf`.</span>
    
    [ ca ]
    <span class="hljs-comment"># `man ca`</span>
    <span class="hljs-constant">default_ca</span> = CA_default
    
    [ CA_default ]
    <span class="hljs-comment"># Directory and file locations.</span>
    <span class="hljs-constant">dir</span>               = /root/ca
    <span class="hljs-constant">certs</span>             = $dir/certs
    <span class="hljs-constant">crl_dir</span>           = $dir/crl
    <span class="hljs-constant">new_certs_dir</span>     = $dir/newcerts
    <span class="hljs-constant">database</span>          = $dir/index.txt
    <span class="hljs-constant">serial</span>            = $dir/serial
    <span class="hljs-constant">RANDFILE</span>          = $dir/private/.rand
    
    <span class="hljs-comment"># The root key and root certificate.</span>
    <span class="hljs-constant">private_key</span>       = $dir/private/ca.key.pem
    <span class="hljs-constant">certificate</span>       = $dir/certs/ca.cert.pem
    
    <span class="hljs-comment"># For certificate revocation lists.</span>
    <span class="hljs-constant">crlnumber</span>         = $dir/crlnumber
    <span class="hljs-constant">crl</span>               = $dir/crl/ca.crl.pem
    <span class="hljs-constant">crl_extensions</span>    = crl_ext
    <span class="hljs-constant">default_crl_days</span>  = 30
    
    <span class="hljs-comment"># SHA-1 is deprecated, so use SHA-2 instead.</span>
    <span class="hljs-constant">default_md</span>        = sha256
    
    <span class="hljs-constant">name_opt</span>          = ca_default
    <span class="hljs-constant">cert_opt</span>          = ca_default
    <span class="hljs-constant">default_days</span>      = 375
    <span class="hljs-constant">preserve</span>          = no
    <span class="hljs-constant">policy</span>            = policy_strict
    
    [ policy_strict ]
    <span class="hljs-comment"># The root CA should only sign intermediate certificates that match.</span>
    <span class="hljs-comment"># See the POLICY FORMAT section of `man ca`.</span>
    <span class="hljs-constant">countryName</span>             = match
    <span class="hljs-constant">stateOrProvinceName</span>     = match
    <span class="hljs-constant">organizationName</span>        = match
    <span class="hljs-constant">organizationalUnitName</span>  = optional
    <span class="hljs-constant">commonName</span>              = supplied
    <span class="hljs-constant">emailAddress</span>            = optional
    
    [ policy_loose ]
    <span class="hljs-comment"># Allow the intermediate CA to sign a more diverse range of certificates.</span>
    <span class="hljs-comment"># See the POLICY FORMAT section of the `ca` man page.</span>
    <span class="hljs-constant">countryName</span>             = optional
    <span class="hljs-constant">stateOrProvinceName</span>     = optional
    <span class="hljs-constant">localityName</span>            = optional
    <span class="hljs-constant">organizationName</span>        = optional
    <span class="hljs-constant">organizationalUnitName</span>  = optional
    <span class="hljs-constant">commonName</span>              = supplied
    <span class="hljs-constant">emailAddress</span>            = optional
    
    [ req ]
    <span class="hljs-comment"># Options for the `req` tool (`man req`).</span>
    <span class="hljs-constant">default_bits</span>        = 2048
    <span class="hljs-constant">distinguished_name</span>  = req_distinguished_name
    <span class="hljs-constant">string_mask</span>         = utf8only
    
    <span class="hljs-comment"># SHA-1 is deprecated, so use SHA-2 instead.</span>
    <span class="hljs-constant">default_md</span>          = sha256
    
    <span class="hljs-comment"># Extension to add when the -x509 option is used.</span>
    <span class="hljs-constant">x509_extensions</span>     = v3_ca
    
    [ req_distinguished_name ]
    <span class="hljs-comment"># See &lt;https://en.wikipedia.org/wiki/Certificate_signing_request&gt;.</span>
    <span class="hljs-constant">countryName</span>                     = Country Name (2 letter code)
    <span class="hljs-constant">stateOrProvinceName</span>             = State or Province Name
    <span class="hljs-constant">localityName</span>                    = Locality Name
    0.organizationName              = Organization Name
    <span class="hljs-constant">organizationalUnitName</span>          = Organizational Unit Name
    <span class="hljs-constant">commonName</span>                      = Common Name
    <span class="hljs-constant">emailAddress</span>                    = Email Address
    
    <span class="hljs-comment"># Optionally, specify some defaults.</span>
    <span class="hljs-constant">countryName_default</span>             = GB
    <span class="hljs-constant">stateOrProvinceName_default</span>     = England
    <span class="hljs-constant">localityName_default</span>            =
    0.organizationName_default      = Alice Ltd
    <span class="hljs-constant">organizationalUnitName_default</span>  =
    <span class="hljs-constant">emailAddress_default</span>            =
    
    [ v3_ca ]
    <span class="hljs-comment"># Extensions for a typical CA (`man x509v3_config`).</span>
    <span class="hljs-constant">subjectKeyIdentifier</span> = hash
    <span class="hljs-constant">authorityKeyIdentifier</span> = keyid:always,issuer
    <span class="hljs-constant">basicConstraints</span> = critical, CA:true
    <span class="hljs-constant">keyUsage</span> = critical, digitalSignature, cRLSign, keyCertSign
    
    [ v3_intermediate_ca ]
    <span class="hljs-comment"># Extensions for a typical intermediate CA (`man x509v3_config`).</span>
    <span class="hljs-constant">subjectKeyIdentifier</span> = hash
    <span class="hljs-constant">authorityKeyIdentifier</span> = keyid:always,issuer
    <span class="hljs-constant">basicConstraints</span> = critical, CA:true, pathlen:0
    <span class="hljs-constant">keyUsage</span> = critical, digitalSignature, cRLSign, keyCertSign
    
    [ usr_cert ]
    <span class="hljs-comment"># Extensions for client certificates (`man x509v3_config`).</span>
    <span class="hljs-constant">basicConstraints</span> = CA:FALSE
    <span class="hljs-constant">nsCertType</span> = client, email
    <span class="hljs-constant">nsComment</span> = "OpenSSL Generated Client Certificate"
    <span class="hljs-constant">subjectKeyIdentifier</span> = hash
    <span class="hljs-constant">authorityKeyIdentifier</span> = keyid,issuer
    <span class="hljs-constant">keyUsage</span> = critical, nonRepudiation, digitalSignature, keyEncipherment
    <span class="hljs-constant">extendedKeyUsage</span> = clientAuth, emailProtection
    
    [ server_cert ]
    <span class="hljs-comment"># Extensions for server certificates (`man x509v3_config`).</span>
    <span class="hljs-constant">basicConstraints</span> = CA:FALSE
    <span class="hljs-constant">nsCertType</span> = server
    <span class="hljs-constant">nsComment</span> = "OpenSSL Generated Server Certificate"
    <span class="hljs-constant">subjectKeyIdentifier</span> = hash
    <span class="hljs-constant">authorityKeyIdentifier</span> = keyid,issuer:always
    <span class="hljs-constant">keyUsage</span> = critical, digitalSignature, keyEncipherment
    <span class="hljs-constant">extendedKeyUsage</span> = serverAuth
    
    [ crl_ext ]
    <span class="hljs-comment"># Extension for CRLs (`man x509v3_config`).</span>
    <span class="hljs-constant">authorityKeyIdentifier</span>=keyid:always
    
    [ ocsp ]
    <span class="hljs-comment"># Extension for OCSP signing certificates (`man ocsp`).</span>
    <span class="hljs-constant">basicConstraints</span> = CA:FALSE
    <span class="hljs-constant">subjectKeyIdentifier</span> = hash
    <span class="hljs-constant">authorityKeyIdentifier</span> = keyid,issuer
    <span class="hljs-constant">keyUsage</span> = critical, digitalSignature
    <span class="hljs-constant">extendedKeyUsage</span> = critical, OCSPSigning</code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li><li style="color: rgb(153, 153, 153);">6</li><li style="color: rgb(153, 153, 153);">7</li><li style="color: rgb(153, 153, 153);">8</li><li style="color: rgb(153, 153, 153);">9</li><li style="color: rgb(153, 153, 153);">10</li><li style="color: rgb(153, 153, 153);">11</li><li style="color: rgb(153, 153, 153);">12</li><li style="color: rgb(153, 153, 153);">13</li><li style="color: rgb(153, 153, 153);">14</li><li style="color: rgb(153, 153, 153);">15</li><li style="color: rgb(153, 153, 153);">16</li><li style="color: rgb(153, 153, 153);">17</li><li style="color: rgb(153, 153, 153);">18</li><li style="color: rgb(153, 153, 153);">19</li><li style="color: rgb(153, 153, 153);">20</li><li style="color: rgb(153, 153, 153);">21</li><li style="color: rgb(153, 153, 153);">22</li><li style="color: rgb(153, 153, 153);">23</li><li style="color: rgb(153, 153, 153);">24</li><li style="color: rgb(153, 153, 153);">25</li><li style="color: rgb(153, 153, 153);">26</li><li style="color: rgb(153, 153, 153);">27</li><li style="color: rgb(153, 153, 153);">28</li><li style="color: rgb(153, 153, 153);">29</li><li style="color: rgb(153, 153, 153);">30</li><li style="color: rgb(153, 153, 153);">31</li><li style="color: rgb(153, 153, 153);">32</li><li style="color: rgb(153, 153, 153);">33</li><li style="color: rgb(153, 153, 153);">34</li><li style="color: rgb(153, 153, 153);">35</li><li style="color: rgb(153, 153, 153);">36</li><li style="color: rgb(153, 153, 153);">37</li><li style="color: rgb(153, 153, 153);">38</li><li style="color: rgb(153, 153, 153);">39</li><li style="color: rgb(153, 153, 153);">40</li><li style="color: rgb(153, 153, 153);">41</li><li style="color: rgb(153, 153, 153);">42</li><li style="color: rgb(153, 153, 153);">43</li><li style="color: rgb(153, 153, 153);">44</li><li style="color: rgb(153, 153, 153);">45</li><li style="color: rgb(153, 153, 153);">46</li><li style="color: rgb(153, 153, 153);">47</li><li style="color: rgb(153, 153, 153);">48</li><li style="color: rgb(153, 153, 153);">49</li><li style="color: rgb(153, 153, 153);">50</li><li style="color: rgb(153, 153, 153);">51</li><li style="color: rgb(153, 153, 153);">52</li><li style="color: rgb(153, 153, 153);">53</li><li style="color: rgb(153, 153, 153);">54</li><li style="color: rgb(153, 153, 153);">55</li><li style="color: rgb(153, 153, 153);">56</li><li style="color: rgb(153, 153, 153);">57</li><li style="color: rgb(153, 153, 153);">58</li><li style="color: rgb(153, 153, 153);">59</li><li style="color: rgb(153, 153, 153);">60</li><li style="color: rgb(153, 153, 153);">61</li><li style="color: rgb(153, 153, 153);">62</li><li style="color: rgb(153, 153, 153);">63</li><li style="color: rgb(153, 153, 153);">64</li><li style="color: rgb(153, 153, 153);">65</li><li style="color: rgb(153, 153, 153);">66</li><li style="color: rgb(153, 153, 153);">67</li><li style="color: rgb(153, 153, 153);">68</li><li style="color: rgb(153, 153, 153);">69</li><li style="color: rgb(153, 153, 153);">70</li><li style="color: rgb(153, 153, 153);">71</li><li style="color: rgb(153, 153, 153);">72</li><li style="color: rgb(153, 153, 153);">73</li><li style="color: rgb(153, 153, 153);">74</li><li style="color: rgb(153, 153, 153);">75</li><li style="color: rgb(153, 153, 153);">76</li><li style="color: rgb(153, 153, 153);">77</li><li style="color: rgb(153, 153, 153);">78</li><li style="color: rgb(153, 153, 153);">79</li><li style="color: rgb(153, 153, 153);">80</li><li style="color: rgb(153, 153, 153);">81</li><li style="color: rgb(153, 153, 153);">82</li><li style="color: rgb(153, 153, 153);">83</li><li style="color: rgb(153, 153, 153);">84</li><li style="color: rgb(153, 153, 153);">85</li><li style="color: rgb(153, 153, 153);">86</li><li style="color: rgb(153, 153, 153);">87</li><li style="color: rgb(153, 153, 153);">88</li><li style="color: rgb(153, 153, 153);">89</li><li style="color: rgb(153, 153, 153);">90</li><li style="color: rgb(153, 153, 153);">91</li><li style="color: rgb(153, 153, 153);">92</li><li style="color: rgb(153, 153, 153);">93</li><li style="color: rgb(153, 153, 153);">94</li><li style="color: rgb(153, 153, 153);">95</li><li style="color: rgb(153, 153, 153);">96</li><li style="color: rgb(153, 153, 153);">97</li><li style="color: rgb(153, 153, 153);">98</li><li style="color: rgb(153, 153, 153);">99</li><li style="color: rgb(153, 153, 153);">100</li><li style="color: rgb(153, 153, 153);">101</li><li style="color: rgb(153, 153, 153);">102</li><li style="color: rgb(153, 153, 153);">103</li><li style="color: rgb(153, 153, 153);">104</li><li style="color: rgb(153, 153, 153);">105</li><li style="color: rgb(153, 153, 153);">106</li><li style="color: rgb(153, 153, 153);">107</li><li style="color: rgb(153, 153, 153);">108</li><li style="color: rgb(153, 153, 153);">109</li><li style="color: rgb(153, 153, 153);">110</li><li style="color: rgb(153, 153, 153);">111</li><li style="color: rgb(153, 153, 153);">112</li><li style="color: rgb(153, 153, 153);">113</li><li style="color: rgb(153, 153, 153);">114</li><li style="color: rgb(153, 153, 153);">115</li><li style="color: rgb(153, 153, 153);">116</li><li style="color: rgb(153, 153, 153);">117</li><li style="color: rgb(153, 153, 153);">118</li><li style="color: rgb(153, 153, 153);">119</li><li style="color: rgb(153, 153, 153);">120</li><li style="color: rgb(153, 153, 153);">121</li><li style="color: rgb(153, 153, 153);">122</li><li style="color: rgb(153, 153, 153);">123</li><li style="color: rgb(153, 153, 153);">124</li><li style="color: rgb(153, 153, 153);">125</li><li style="color: rgb(153, 153, 153);">126</li><li style="color: rgb(153, 153, 153);">127</li><li style="color: rgb(153, 153, 153);">128</li><li style="color: rgb(153, 153, 153);">129</li><li style="color: rgb(153, 153, 153);">130</li><li style="color: rgb(153, 153, 153);">131</li><li style="color: rgb(153, 153, 153);">132</li></ul></pre>
    
    
    
    <h3 id="6-7-2-intermediate-ca-configuration-file"><a name="t50"></a>6-7-2) Intermediate CA configuration file</h3>
    
    
    
    <pre class="prettyprint" name="code"><code class="hljs makefile has-numbering"><span class="hljs-comment"># OpenSSL intermediate CA configuration file.</span>
    <span class="hljs-comment"># Copy to `/root/ca/intermediate/openssl.cnf`.</span>
    
    [ ca ]
    <span class="hljs-comment"># `man ca`</span>
    <span class="hljs-constant">default_ca</span> = CA_default
    
    [ CA_default ]
    <span class="hljs-comment"># Directory and file locations.</span>
    <span class="hljs-constant">dir</span>               = /root/ca/intermediate
    <span class="hljs-constant">certs</span>             = $dir/certs
    <span class="hljs-constant">crl_dir</span>           = $dir/crl
    <span class="hljs-constant">new_certs_dir</span>     = $dir/newcerts
    <span class="hljs-constant">database</span>          = $dir/index.txt
    <span class="hljs-constant">serial</span>            = $dir/serial
    <span class="hljs-constant">RANDFILE</span>          = $dir/private/.rand
    
    <span class="hljs-comment"># The root key and root certificate.</span>
    <span class="hljs-constant">private_key</span>       = $dir/private/intermediate.key.pem
    <span class="hljs-constant">certificate</span>       = $dir/certs/intermediate.cert.pem
    
    <span class="hljs-comment"># For certificate revocation lists.</span>
    <span class="hljs-constant">crlnumber</span>         = $dir/crlnumber
    <span class="hljs-constant">crl</span>               = $dir/crl/intermediate.crl.pem
    <span class="hljs-constant">crl_extensions</span>    = crl_ext
    <span class="hljs-constant">default_crl_days</span>  = 30
    
    <span class="hljs-comment"># SHA-1 is deprecated, so use SHA-2 instead.</span>
    <span class="hljs-constant">default_md</span>        = sha256
    
    <span class="hljs-constant">name_opt</span>          = ca_default
    <span class="hljs-constant">cert_opt</span>          = ca_default
    <span class="hljs-constant">default_days</span>      = 375
    <span class="hljs-constant">preserve</span>          = no
    <span class="hljs-constant">policy</span>            = policy_loose
    
    [ policy_strict ]
    <span class="hljs-comment"># The root CA should only sign intermediate certificates that match.</span>
    <span class="hljs-comment"># See the POLICY FORMAT section of `man ca`.</span>
    <span class="hljs-constant">countryName</span>             = match
    <span class="hljs-constant">stateOrProvinceName</span>     = match
    <span class="hljs-constant">organizationName</span>        = match
    <span class="hljs-constant">organizationalUnitName</span>  = optional
    <span class="hljs-constant">commonName</span>              = supplied
    <span class="hljs-constant">emailAddress</span>            = optional
    
    [ policy_loose ]
    <span class="hljs-comment"># Allow the intermediate CA to sign a more diverse range of certificates.</span>
    <span class="hljs-comment"># See the POLICY FORMAT section of the `ca` man page.</span>
    <span class="hljs-constant">countryName</span>             = optional
    <span class="hljs-constant">stateOrProvinceName</span>     = optional
    <span class="hljs-constant">localityName</span>            = optional
    <span class="hljs-constant">organizationName</span>        = optional
    <span class="hljs-constant">organizationalUnitName</span>  = optional
    <span class="hljs-constant">commonName</span>              = supplied
    <span class="hljs-constant">emailAddress</span>            = optional
    
    [ req ]
    <span class="hljs-comment"># Options for the `req` tool (`man req`).</span>
    <span class="hljs-constant">default_bits</span>        = 2048
    <span class="hljs-constant">distinguished_name</span>  = req_distinguished_name
    <span class="hljs-constant">string_mask</span>         = utf8only
    
    <span class="hljs-comment"># SHA-1 is deprecated, so use SHA-2 instead.</span>
    <span class="hljs-constant">default_md</span>          = sha256
    
    <span class="hljs-comment"># Extension to add when the -x509 option is used.</span>
    <span class="hljs-constant">x509_extensions</span>     = v3_ca
    
    [ req_distinguished_name ]
    <span class="hljs-comment"># See &lt;https://en.wikipedia.org/wiki/Certificate_signing_request&gt;.</span>
    <span class="hljs-constant">countryName</span>                     = Country Name (2 letter code)
    <span class="hljs-constant">stateOrProvinceName</span>             = State or Province Name
    <span class="hljs-constant">localityName</span>                    = Locality Name
    0.organizationName              = Organization Name
    <span class="hljs-constant">organizationalUnitName</span>          = Organizational Unit Name
    <span class="hljs-constant">commonName</span>                      = Common Name
    <span class="hljs-constant">emailAddress</span>                    = Email Address
    
    <span class="hljs-comment"># Optionally, specify some defaults.</span>
    <span class="hljs-constant">countryName_default</span>             = GB
    <span class="hljs-constant">stateOrProvinceName_default</span>     = England
    <span class="hljs-constant">localityName_default</span>            =
    0.organizationName_default      = Alice Ltd
    <span class="hljs-constant">organizationalUnitName_default</span>  =
    <span class="hljs-constant">emailAddress_default</span>            =
    
    [ v3_ca ]
    <span class="hljs-comment"># Extensions for a typical CA (`man x509v3_config`).</span>
    <span class="hljs-constant">subjectKeyIdentifier</span> = hash
    <span class="hljs-constant">authorityKeyIdentifier</span> = keyid:always,issuer
    <span class="hljs-constant">basicConstraints</span> = critical, CA:true
    <span class="hljs-constant">keyUsage</span> = critical, digitalSignature, cRLSign, keyCertSign
    
    [ v3_intermediate_ca ]
    <span class="hljs-comment"># Extensions for a typical intermediate CA (`man x509v3_config`).</span>
    <span class="hljs-constant">subjectKeyIdentifier</span> = hash
    <span class="hljs-constant">authorityKeyIdentifier</span> = keyid:always,issuer
    <span class="hljs-constant">basicConstraints</span> = critical, CA:true, pathlen:0
    <span class="hljs-constant">keyUsage</span> = critical, digitalSignature, cRLSign, keyCertSign
    
    [ usr_cert ]
    <span class="hljs-comment"># Extensions for client certificates (`man x509v3_config`).</span>
    <span class="hljs-constant">basicConstraints</span> = CA:FALSE
    <span class="hljs-constant">nsCertType</span> = client, email
    <span class="hljs-constant">nsComment</span> = "OpenSSL Generated Client Certificate"
    <span class="hljs-constant">subjectKeyIdentifier</span> = hash
    <span class="hljs-constant">authorityKeyIdentifier</span> = keyid,issuer
    <span class="hljs-constant">keyUsage</span> = critical, nonRepudiation, digitalSignature, keyEncipherment
    <span class="hljs-constant">extendedKeyUsage</span> = clientAuth, emailProtection
    
    [ server_cert ]
    <span class="hljs-comment"># Extensions for server certificates (`man x509v3_config`).</span>
    <span class="hljs-constant">basicConstraints</span> = CA:FALSE
    <span class="hljs-constant">nsCertType</span> = server
    <span class="hljs-constant">nsComment</span> = "OpenSSL Generated Server Certificate"
    <span class="hljs-constant">subjectKeyIdentifier</span> = hash
    <span class="hljs-constant">authorityKeyIdentifier</span> = keyid,issuer:always
    <span class="hljs-constant">keyUsage</span> = critical, digitalSignature, keyEncipherment
    <span class="hljs-constant">extendedKeyUsage</span> = serverAuth
    
    [ crl_ext ]
    <span class="hljs-comment"># Extension for CRLs (`man x509v3_config`).</span>
    <span class="hljs-constant">authorityKeyIdentifier</span>=keyid:always
    
    [ ocsp ]
    <span class="hljs-comment"># Extension for OCSP signing certificates (`man ocsp`).</span>
    <span class="hljs-constant">basicConstraints</span> = CA:FALSE
    <span class="hljs-constant">subjectKeyIdentifier</span> = hash
    <span class="hljs-constant">authorityKeyIdentifier</span> = keyid,issuer
    <span class="hljs-constant">keyUsage</span> = critical, digitalSignature
    <span class="hljs-constant">extendedKeyUsage</span> = critical, OCSPSigning</code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li><li style="color: rgb(153, 153, 153);">6</li><li style="color: rgb(153, 153, 153);">7</li><li style="color: rgb(153, 153, 153);">8</li><li style="color: rgb(153, 153, 153);">9</li><li style="color: rgb(153, 153, 153);">10</li><li style="color: rgb(153, 153, 153);">11</li><li style="color: rgb(153, 153, 153);">12</li><li style="color: rgb(153, 153, 153);">13</li><li style="color: rgb(153, 153, 153);">14</li><li style="color: rgb(153, 153, 153);">15</li><li style="color: rgb(153, 153, 153);">16</li><li style="color: rgb(153, 153, 153);">17</li><li style="color: rgb(153, 153, 153);">18</li><li style="color: rgb(153, 153, 153);">19</li><li style="color: rgb(153, 153, 153);">20</li><li style="color: rgb(153, 153, 153);">21</li><li style="color: rgb(153, 153, 153);">22</li><li style="color: rgb(153, 153, 153);">23</li><li style="color: rgb(153, 153, 153);">24</li><li style="color: rgb(153, 153, 153);">25</li><li style="color: rgb(153, 153, 153);">26</li><li style="color: rgb(153, 153, 153);">27</li><li style="color: rgb(153, 153, 153);">28</li><li style="color: rgb(153, 153, 153);">29</li><li style="color: rgb(153, 153, 153);">30</li><li style="color: rgb(153, 153, 153);">31</li><li style="color: rgb(153, 153, 153);">32</li><li style="color: rgb(153, 153, 153);">33</li><li style="color: rgb(153, 153, 153);">34</li><li style="color: rgb(153, 153, 153);">35</li><li style="color: rgb(153, 153, 153);">36</li><li style="color: rgb(153, 153, 153);">37</li><li style="color: rgb(153, 153, 153);">38</li><li style="color: rgb(153, 153, 153);">39</li><li style="color: rgb(153, 153, 153);">40</li><li style="color: rgb(153, 153, 153);">41</li><li style="color: rgb(153, 153, 153);">42</li><li style="color: rgb(153, 153, 153);">43</li><li style="color: rgb(153, 153, 153);">44</li><li style="color: rgb(153, 153, 153);">45</li><li style="color: rgb(153, 153, 153);">46</li><li style="color: rgb(153, 153, 153);">47</li><li style="color: rgb(153, 153, 153);">48</li><li style="color: rgb(153, 153, 153);">49</li><li style="color: rgb(153, 153, 153);">50</li><li style="color: rgb(153, 153, 153);">51</li><li style="color: rgb(153, 153, 153);">52</li><li style="color: rgb(153, 153, 153);">53</li><li style="color: rgb(153, 153, 153);">54</li><li style="color: rgb(153, 153, 153);">55</li><li style="color: rgb(153, 153, 153);">56</li><li style="color: rgb(153, 153, 153);">57</li><li style="color: rgb(153, 153, 153);">58</li><li style="color: rgb(153, 153, 153);">59</li><li style="color: rgb(153, 153, 153);">60</li><li style="color: rgb(153, 153, 153);">61</li><li style="color: rgb(153, 153, 153);">62</li><li style="color: rgb(153, 153, 153);">63</li><li style="color: rgb(153, 153, 153);">64</li><li style="color: rgb(153, 153, 153);">65</li><li style="color: rgb(153, 153, 153);">66</li><li style="color: rgb(153, 153, 153);">67</li><li style="color: rgb(153, 153, 153);">68</li><li style="color: rgb(153, 153, 153);">69</li><li style="color: rgb(153, 153, 153);">70</li><li style="color: rgb(153, 153, 153);">71</li><li style="color: rgb(153, 153, 153);">72</li><li style="color: rgb(153, 153, 153);">73</li><li style="color: rgb(153, 153, 153);">74</li><li style="color: rgb(153, 153, 153);">75</li><li style="color: rgb(153, 153, 153);">76</li><li style="color: rgb(153, 153, 153);">77</li><li style="color: rgb(153, 153, 153);">78</li><li style="color: rgb(153, 153, 153);">79</li><li style="color: rgb(153, 153, 153);">80</li><li style="color: rgb(153, 153, 153);">81</li><li style="color: rgb(153, 153, 153);">82</li><li style="color: rgb(153, 153, 153);">83</li><li style="color: rgb(153, 153, 153);">84</li><li style="color: rgb(153, 153, 153);">85</li><li style="color: rgb(153, 153, 153);">86</li><li style="color: rgb(153, 153, 153);">87</li><li style="color: rgb(153, 153, 153);">88</li><li style="color: rgb(153, 153, 153);">89</li><li style="color: rgb(153, 153, 153);">90</li><li style="color: rgb(153, 153, 153);">91</li><li style="color: rgb(153, 153, 153);">92</li><li style="color: rgb(153, 153, 153);">93</li><li style="color: rgb(153, 153, 153);">94</li><li style="color: rgb(153, 153, 153);">95</li><li style="color: rgb(153, 153, 153);">96</li><li style="color: rgb(153, 153, 153);">97</li><li style="color: rgb(153, 153, 153);">98</li><li style="color: rgb(153, 153, 153);">99</li><li style="color: rgb(153, 153, 153);">100</li><li style="color: rgb(153, 153, 153);">101</li><li style="color: rgb(153, 153, 153);">102</li><li style="color: rgb(153, 153, 153);">103</li><li style="color: rgb(153, 153, 153);">104</li><li style="color: rgb(153, 153, 153);">105</li><li style="color: rgb(153, 153, 153);">106</li><li style="color: rgb(153, 153, 153);">107</li><li style="color: rgb(153, 153, 153);">108</li><li style="color: rgb(153, 153, 153);">109</li><li style="color: rgb(153, 153, 153);">110</li><li style="color: rgb(153, 153, 153);">111</li><li style="color: rgb(153, 153, 153);">112</li><li style="color: rgb(153, 153, 153);">113</li><li style="color: rgb(153, 153, 153);">114</li><li style="color: rgb(153, 153, 153);">115</li><li style="color: rgb(153, 153, 153);">116</li><li style="color: rgb(153, 153, 153);">117</li><li style="color: rgb(153, 153, 153);">118</li><li style="color: rgb(153, 153, 153);">119</li><li style="color: rgb(153, 153, 153);">120</li><li style="color: rgb(153, 153, 153);">121</li><li style="color: rgb(153, 153, 153);">122</li><li style="color: rgb(153, 153, 153);">123</li><li style="color: rgb(153, 153, 153);">124</li><li style="color: rgb(153, 153, 153);">125</li><li style="color: rgb(153, 153, 153);">126</li><li style="color: rgb(153, 153, 153);">127</li><li style="color: rgb(153, 153, 153);">128</li><li style="color: rgb(153, 153, 153);">129</li><li style="color: rgb(153, 153, 153);">130</li><li style="color: rgb(153, 153, 153);">131</li><li style="color: rgb(153, 153, 153);">132</li></ul></pre>            </div>
                            <link href="https://csdnimg.cn/release/phoenix/mdeditor/markdown_views-8cccb36679.css" rel="stylesheet">
                    </div>
            
        </article>
    </body>
</html>